This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA/Python] Fix int() builtin with range type gdb.Value objects.
- From: Tom Tromey <tromey at redhat dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 19 Nov 2013 08:07:36 -0700
- Subject: Re: [RFA/Python] Fix int() builtin with range type gdb.Value objects.
- Authentication-results: sourceware.org; auth=none
- References: <1384773267-4883-1-git-send-email-brobecker at adacore dot com> <87r4adpupf dot fsf at fleche dot redhat dot com> <20131119030458 dot GE3481 at adacore dot com>
>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:
Joel> * python/py-value.c (is_intlike): Delete.
Joel> (valpy_int): Replace use of CHECK_TYPEDEF and is_intlike
Joel> by use of is_integral_type.
Joel> (valpy_long): Replace use of CHECK_TYPEDEF and is_intlike
Joel> by use of is_integral_type and check for TYPE_CODE_PTR.
Thanks, Joel.
Joel> TRY_CATCH (except, RETURN_MASK_ALL)
Joel> {
Joel> - CHECK_TYPEDEF (type);
Joel> -
Joel> - if (!is_intlike (type, 1))
Joel> + if (!is_integral_type (type)
Joel> + && TYPE_CODE (type) != TYPE_CODE_PTR)
Joel> error (_("Cannot convert value to long."));
I think the CHECK_TYPEDEF is still needed in this hunk (but not the
other one), since we examine the TYPE_CODE of the type.
Tom