GNOME Bugzilla – Bug 626536
enums aren't wrapped into GValues
Last modified: 2012-10-17 23:19:55 UTC
This test fails: diff --git a/tests/test_gi.py b/tests/test_gi.py index 08caf48..6804b53 100644 --- a/tests/test_gi.py +++ b/tests/test_gi.py @@ -939,6 +939,10 @@ class TestGValue(unittest.TestCase): GIMarshallingTests.gvalue_in(42) self.assertRaises(TypeError, GIMarshallingTests.gvalue_in, None) + def test_gvalue_in(self): + GIMarshallingTests.gvalue_in_enum(GIMarshallingTests.Enum.VALUE3) + self.assertRaises(TypeError, GIMarshallingTests.gvalue_in, None) + def test_gvalue_out(self): self.assertEquals(42, GIMarshallingTests.gvalue_out()) with: TypeError: argument 0: Must be of a known GType, not Enum
The solution here would be to assign __gtype__ = G_TYPE_ENUM when constructing Enums
That doesn't work since for GValues we send in the type to pyg_type_from_object and __gtype__ is set on the object, not it's type. Unfortunately the type all depends on what module it is coming from. For instance GIMarshallingTests.Enum.VALUE3 is of type GIMarshallingTests.Enum but is defined in gi/types.py. G_TYPE_ENUM is also an abstract type and can not be used to initialize a GValue.
I just ran the tests with the patch applied using pygobject 3.2.0 and no longer can see a crash. Could you please confirm that this issue is indeed fixed?
Tomeu, can you reproduce the issue with pygobject 3.2.0 or later version ?
Closing this bug report as no further information has been provided. Please feel free to reopen this bug if you can provide the information asked for. Thanks!