summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2010-02-18 23:55:01 -0500
committerDavid Malcolm <dmalcolm@redhat.com>2010-02-18 23:55:01 -0500
commit29e5f5aa12775bdc6118b9459e2732ff1327e191 (patch)
treed0b6b285c85e58d9042ebd0599ef9b6901c22f88
parentb2edaec1f711edbe28cc72b960efaf24d4cdc06a (diff)
downloadlibpython-29e5f5aa12775bdc6118b9459e2732ff1327e191.tar.gz
libpython-29e5f5aa12775bdc6118b9459e2732ff1327e191.tar.xz
libpython-29e5f5aa12775bdc6118b9459e2732ff1327e191.zip
Add support for the "None" singleton
-rw-r--r--libpython.py10
1 files changed, 10 insertions, 0 deletions
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):