diff options
| -rw-r--r-- | ChangeLog | 11 | ||||
| -rw-r--r-- | gobject/pygtype.c | 2 | ||||
| -rw-r--r-- | tests/test_signal.py | 15 |
3 files changed, 27 insertions, 1 deletions
@@ -1,3 +1,14 @@ +2007-04-29 James Livingstone <doclivingstone@gmail.com> + + reviewed by: Johan Dahlin <johan@gnome.org> + + * gobject/pygtype.c: (pyg_value_from_pyobject): + * tests/test_signal.py: + + Add a missing else to avoid throwing a TypeError. + Includes a test written by Ed Catmur. + Fixes #374653 + 2007-04-29 Johan Dahlin <johan@gnome.org> * gobject/pygtype.c: (pyg_value_array_from_pyobject): diff --git a/gobject/pygtype.c b/gobject/pygtype.c index 5606e2a..59ba580 100644 --- a/gobject/pygtype.c +++ b/gobject/pygtype.c @@ -849,7 +849,7 @@ pyg_value_from_pyobject(GValue *value, PyObject *obj) if (obj == Py_None) g_value_set_boxed(value, NULL); - if (G_VALUE_HOLDS(value, PY_TYPE_OBJECT)) + else if (G_VALUE_HOLDS(value, PY_TYPE_OBJECT)) g_value_set_boxed(value, obj); else if (PyObject_TypeCheck(obj, &PyGBoxed_Type) && G_VALUE_HOLDS(value, ((PyGBoxed *)obj)->gtype)) diff --git a/tests/test_signal.py b/tests/test_signal.py index 99bb45b..6c41ece 100644 --- a/tests/test_signal.py +++ b/tests/test_signal.py @@ -2,6 +2,7 @@ import gc import unittest +import sys from common import gobject, testhelper @@ -364,5 +365,19 @@ else: print '** WARNING: LIBFFI disabled, not testing' print +# Test for 374653 +class TestPyGValue(unittest.TestCase): + def testNoneNULLBoxedConversion(self): + class C(gobject.GObject): + __gsignals__ = dict(my_boxed_signal=( + gobject.SIGNAL_RUN_LAST, + gobject.type_from_name('GStrv'), ())) + + obj = C() + obj.connect('my-boxed-signal', lambda obj: None) + sys.last_type = None + obj.emit('my-boxed-signal') + assert not sys.last_type + if __name__ == '__main__': unittest.main() |
