mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-15 04:31:49 +08:00
90fe61ced1
When running the gdb.python/py-arch.exp tests on a GDB built against Python 2 I ran into some errors. The problem is that this test script exercises the gdb.Architecture.integer_type method, and this method uses 'p' as an argument format specifier in a call to gdb_PyArg_ParseTupleAndKeywords. Unfortunately this specified was only added in Python 3.3, so will cause an error for earlier versions of Python. This commit switches to use the 'O' specifier to collect a PyObject, and then uses PyObject_IsTrue to convert the object to a boolean. An earlier version of this patch incorrectly switched from using 'p' to use 'i', however, it was pointed out during review that this would cause some changes in behaviour, for example both of these will work with 'p', but not with 'i': gdb.selected_inferior().architecture().integer_type(32, None) gdb.selected_inferior().architecture().integer_type(32, "foo") The new approach of using 'O' works fine with these cases. I've added some new tests to cover both of the above. There should be no user visible changes after this commit. |
||
---|---|---|
.. | ||
lib/gdb | ||
py-all-events.def | ||
py-arch.c | ||
py-auto-load.c | ||
py-block.c | ||
py-bpevent.c | ||
py-breakpoint.c | ||
py-cmd.c | ||
py-connection.c | ||
py-continueevent.c | ||
py-event-types.def | ||
py-event.c | ||
py-event.h | ||
py-events.h | ||
py-evtregistry.c | ||
py-evts.c | ||
py-exitedevent.c | ||
py-finishbreakpoint.c | ||
py-frame.c | ||
py-framefilter.c | ||
py-function.c | ||
py-gdb-readline.c | ||
py-inferior.c | ||
py-infevents.c | ||
py-infthread.c | ||
py-instruction.c | ||
py-instruction.h | ||
py-lazy-string.c | ||
py-linetable.c | ||
py-membuf.c | ||
py-newobjfileevent.c | ||
py-objfile.c | ||
py-param.c | ||
py-prettyprint.c | ||
py-progspace.c | ||
py-record-btrace.c | ||
py-record-btrace.h | ||
py-record-full.c | ||
py-record-full.h | ||
py-record.c | ||
py-record.h | ||
py-ref.h | ||
py-registers.c | ||
py-signalevent.c | ||
py-stopevent.c | ||
py-stopevent.h | ||
py-symbol.c | ||
py-symtab.c | ||
py-threadevent.c | ||
py-tui.c | ||
py-type.c | ||
py-unwind.c | ||
py-utils.c | ||
py-value.c | ||
py-varobj.c | ||
py-xmethods.c | ||
python-config.py | ||
python-internal.h | ||
python.c | ||
python.h |