From 9084855e571ab3e2fa82910e3b53d6268b1e627a Mon Sep 17 00:00:00 2001 From: Mark Florisson Date: Sat, 6 Nov 2010 22:57:50 +0100 Subject: [PATCH] Pretty print any supported python object (previously it only pretty printed objects recognized as PyObject * and PyFrameObject *) --- Cython/Debugger/libpython.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Cython/Debugger/libpython.py b/Cython/Debugger/libpython.py index ae73353f..7cc7240c 100644 --- a/Cython/Debugger/libpython.py +++ b/Cython/Debugger/libpython.py @@ -1108,12 +1108,16 @@ class PyObjectPtrPrinter: proxyval = pyop.proxyval(set()) return stringify(proxyval) + def pretty_printer_lookup(gdbval): type = gdbval.type.unqualified() if type.code == gdb.TYPE_CODE_PTR: type = type.target().unqualified() - t = str(type) - if t in ("PyObject", "PyFrameObject"): + # do this every time to allow new subclasses to "register" + # alternatively, we could use a metaclass to register all the typenames + classes = [PyObjectPtr] + classes.extend(PyObjectPtr.__subclasses__()) + if str(type) in [cls._typename for cls in classes]: return PyObjectPtrPrinter(gdbval) """ -- 2.26.2