summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Wilson <msw@redhat.com>2002-06-17 18:28:38 +0000
committerMatt Wilson <msw@src.gnome.org>2002-06-17 18:28:38 +0000
commit8a4a369dd860c5e584c5562c3b90e7d1290796a3 (patch)
treeb671bd0f1cdfc05be9610b2053aca1dda2991505
parent10d27f229d4acc898baadadb4ae1c697a3c71df5 (diff)
downloadpygobject-8a4a369dd860c5e584c5562c3b90e7d1290796a3.tar.gz
pygobject-8a4a369dd860c5e584c5562c3b90e7d1290796a3.tar.xz
pygobject-8a4a369dd860c5e584c5562c3b90e7d1290796a3.zip
if a value holds a PyObject*, the code that is getting the value is
2002-06-17 Matt Wilson <msw@redhat.com> * pygtype.c (pyg_value_as_pyobject): if a value holds a PyObject*, the code that is getting the value is expecting a valid object. Translate NULL pointers to Py_None.
-rw-r--r--gobject/pygtype.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/gobject/pygtype.c b/gobject/pygtype.c
index 686e4a8..d03f7f6 100644
--- a/gobject/pygtype.c
+++ b/gobject/pygtype.c
@@ -565,9 +565,15 @@ pyg_value_as_pyobject(const GValue *value)
{
PyGBoxedMarshal *bm;
- if (G_VALUE_HOLDS(value, PY_TYPE_OBJECT))
- return (PyObject *)g_value_dup_boxed(value);
-
+ if (G_VALUE_HOLDS(value, PY_TYPE_OBJECT)) {
+ PyObject *ret = (PyObject *)g_value_dup_boxed(value);
+ if (ret == NULL) {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+ return ret;
+ }
+
bm = pyg_boxed_lookup(G_VALUE_TYPE(value));
if (bm)
return bm->fromvalue(value);