From 29e5f5aa12775bdc6118b9459e2732ff1327e191 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Thu, 18 Feb 2010 23:55:01 -0500 Subject: Add support for the "None" singleton --- libpython.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libpython.py b/libpython.py index da19554..c045fa9 100644 --- a/libpython.py +++ b/libpython.py @@ -186,6 +186,7 @@ class PyObjectPtr(object): 'instance': PyInstanceObjectPtr, 'list': PyListObjectPtr, 'long': PyLongObjectPtr, + 'NoneType': PyNoneStructPtr, 'tuple': PyTupleObjectPtr, 'frame': PyFrameObjectPtr, 'unicode': PyUnicodeObjectPtr, @@ -355,6 +356,15 @@ class PyLongObjectPtr(PyObjectPtr): result = -result return result +class PyNoneStructPtr(PyObjectPtr): + """ + Class wrapping a gdb.Value that's a PyObject* pointing to the + singleton (we hope) _Py_NoneStruct with ob_type PyNone_Type + """ + _typename = 'PyObject' + def proxyval(self): + return None + class PyFrameObjectPtr(PyObjectPtr): _typename = 'PyFrameObject' def __str__(self): -- cgit