Mercurial > cpython-lru_cache-weakref
diff Tools/gdb/libpython.py @ 73885:50c7ac2fe13c
libpython.py: defer call to gdb.lookup_type('PyUnicodeObject')
The lookup fails at startup if Python is linked to a shared library.
| author | Victor Stinner <victor.stinner@haypocalc.com> |
|---|---|
| date | Thu, 08 Dec 2011 00:08:22 +0100 |
| parents | 694f70ea1419 |
| children | 021e5bb297d1 |
line wrap: on
line diff
--- a/Tools/gdb/libpython.py Wed Dec 07 23:17:58 2011 +0100 +++ b/Tools/gdb/libpython.py Thu Dec 08 00:08:22 2011 +0100 @@ -53,7 +53,8 @@ _type_unsigned_short_ptr = gdb.lookup_type('unsigned short').pointer() _type_unsigned_int_ptr = gdb.lookup_type('unsigned int').pointer() -_is_pep393 = 'data' in [f.name for f in gdb.lookup_type('PyUnicodeObject').target().fields()] +# value computed later, see PyUnicodeObjectPtr.proxy() +_is_pep393 = None SIZEOF_VOID_P = _type_void_ptr.sizeof @@ -1123,6 +1124,10 @@ return _type_Py_UNICODE.sizeof def proxyval(self, visited): + global _is_pep393 + if _is_pep393 is None: + fields = gdb.lookup_type('PyUnicodeObject').target().fields() + _is_pep393 = 'data' in [f.name for f in fields] if _is_pep393: # Python 3.3 and newer may_have_surrogates = False
