[Python-checkins] closes bpo-16637: libpython: construct integer object directly from gdbvalue (GH-15232)

Benjamin Peterson webhook-mailer at python.org
Mon Sep 23 23:34:17 EDT 2019


https://github.com/python/cpython/commit/6f53d34fb0f944a8c0ee530334c353559ac40f72
commit: 6f53d34fb0f944a8c0ee530334c353559ac40f72
branch: master
author: Marc Hartmayer <marc1006 at users.noreply.github.com>
committer: Benjamin Peterson <benjamin at python.org>
date: 2019-09-23T20:34:12-07:00
summary:

closes bpo-16637: libpython: construct integer object directly from gdbvalue (GH-15232)

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.

files:
M Tools/gdb/libpython.py

diff --git a/Tools/gdb/libpython.py b/Tools/gdb/libpython.py
index e28513db261b..2ab7d3b11cad 100755
--- a/Tools/gdb/libpython.py
+++ b/Tools/gdb/libpython.py
@@ -1392,7 +1392,7 @@ def write_repr(self, out, visited):
 
 
 def int_from_int(gdbval):
-    return int(str(gdbval))
+    return int(gdbval)
 
 
 def stringify(val):



More information about the Python-checkins mailing list