This is the mail archive of the gdb-testers@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Allow conversion of pointers to Python int


*** TEST RESULTS FOR COMMIT f5769a2c696affc3ae1274e2329777d7d4d7e8be ***

Author: Tom Tromey <tom@tromey.com>
Branch: master
Commit: f5769a2c696affc3ae1274e2329777d7d4d7e8be

Allow conversion of pointers to Python int

PR python/18170 questions why it's not possible to convert a pointer
value to a Python int.

Digging a bit shows that the Python 2.7 int() constructor will happily
return a long in some cases.  And, it seems gdb already understands
this in other places -- this is what gdb_py_object_from_longest
handles.

So, this patch simply extends valpy_int to allow pointer conversions,
as valpy_long does.

gdb/ChangeLog
2018-09-23  Tom Tromey  <tom@tromey.com>

	PR python/18170:
	* python/py-value.c (valpy_int): Allow conversion from pointer
	type.

gdb/testsuite/ChangeLog
2018-09-23  Tom Tromey  <tom@tromey.com>

	PR python/18170:
	* gdb.python/py-value.exp (test_value_numeric_ops): Add tests to
	convert pointers to int and long.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]