diff Tools/gdb/libpython.py @ 60812:6d836b10e370

Adapt libpython.py and test_gdb.py to Python3 * Rename PyStringObjectPtr to PyBytesObjectPtr * Replace PyObject_Print by textiowrapper_write
author Victor Stinner <victor.stinner@haypocalc.com>
date Wed, 21 Apr 2010 13:53:05 +0000
parents a2a4d9dc7884
children 888c75a1be55
line wrap: on
line diff
--- a/Tools/gdb/libpython.py	Wed Apr 21 13:35:21 2010 +0000
+++ b/Tools/gdb/libpython.py	Wed Apr 21 13:53:05 2010 +0000
@@ -19,7 +19,7 @@
 In particular, given a gdb.Value corresponding to a PyObject* in the inferior
 process, we can generate a "proxy value" within the gdb process.  For example,
 given a PyObject* in the inferior process that is in fact a PyListObject*
-holding three PyObject* that turn out to be PyStringObject* instances, we can
+holding three PyObject* that turn out to be PyBytesObject* instances, we can
 generate a proxy value within the gdb process that is a list of strings:
   ["foo", "bar", "baz"]
 
@@ -108,7 +108,7 @@
 class PyObjectPtr(object):
     """
     Class wrapping a gdb.Value that's a either a (PyObject*) within the
-    inferior process, or some subclass pointer e.g. (PyStringObject*)
+    inferior process, or some subclass pointer e.g. (PyBytesObject*)
 
     There will be a subclass for every refined PyObject type that we care
     about.
@@ -319,7 +319,7 @@
         if tp_flags & Py_TPFLAGS_TUPLE_SUBCLASS:
             return PyTupleObjectPtr
         if tp_flags & Py_TPFLAGS_STRING_SUBCLASS:
-            return PyStringObjectPtr
+            return PyBytesObjectPtr
         if tp_flags & Py_TPFLAGS_UNICODE_SUBCLASS:
             return PyUnicodeObjectPtr
         if tp_flags & Py_TPFLAGS_DICT_SUBCLASS:
@@ -958,8 +958,8 @@
         out.write('])')
 
 
-class PyStringObjectPtr(PyObjectPtr):
-    _typename = 'PyStringObject'
+class PyBytesObjectPtr(PyObjectPtr):
+    _typename = 'PyBytesObject'
 
     def __str__(self):
         field_ob_size = self.field('ob_size')