GNOME Bugzilla – Bug 374653
missing else breaks None->NULL for boxed types
Last modified: 2007-04-30 05:13:48 UTC
pygtypes.c is missing an "else", which means that pyg_value_from_pyobject() can't convert None into NULL for boxed types, and instead throws a TypeError.
Created attachment 76474 [details] [review] patch This trivial patch fixes it for me.
James: Thanks for the patch, do you think you can write a simple test case to demonstrate the bug too?
Here's a standalone unittest: import unittest import gobject, sys class C (gobject.GObject): __gsignals__ = { 'my-boxed-signal': (gobject.SIGNAL_RUN_LAST, gobject.type_from_name('GStrv'), ()) } class TestPyGValue(unittest.TestCase): def testNoneNULLBoxedConversion(self): 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() Sorry about the futzing with sys.last_type - not sure how best to get at an exception in a PyGClosure.
James, Ed: Thanks for the patch/test. This got committed to svn trunk as revision 657.
Update patch status.