From: Mark Florisson Date: Sat, 6 Nov 2010 21:57:50 +0000 (+0100) Subject: Pretty print any supported python object (previously it only pretty printed objects... X-Git-Tag: 0.14.beta0~1^2~36 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9084855e571ab3e2fa82910e3b53d6268b1e627a;p=cython.git Pretty print any supported python object (previously it only pretty printed objects recognized as PyObject * and PyFrameObject *) --- 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) """