]> granicus.if.org Git - python/commitdiff
closes bpo-16637: libpython: construct integer object directly from gdbvalue (GH...
authorMarc Hartmayer <marc1006@users.noreply.github.com>
Tue, 24 Sep 2019 03:34:12 +0000 (05:34 +0200)
committerBenjamin Peterson <benjamin@python.org>
Tue, 24 Sep 2019 03:34:12 +0000 (20:34 -0700)
This fixes the exception '`ValueError: invalid literal for int() with base 10`
if `str(gdbval)` returns a hexadecimal value (e.g. '0xa0'). This is the case if
the output-radix is set to 16 in gdb. See
https://sourceware.org/gdb/onlinedocs/gdb/Numbers.html for more information.

Tools/gdb/libpython.py

index e28513db261ba36e82158069db4212829c91e8e2..2ab7d3b11cadadb3512d436331a78d532cd68b82 100755 (executable)
@@ -1392,7 +1392,7 @@ class wrapperobject(PyObjectPtr):
 
 
 def int_from_int(gdbval):
-    return int(str(gdbval))
+    return int(gdbval)
 
 
 def stringify(val):