After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 626536 - enums aren't wrapped into GValues
enums aren't wrapped into GValues
Status: RESOLVED INCOMPLETE
Product: pygobject
Classification: Bindings
Component: introspection
Git master
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2010-08-10 15:07 UTC by Tomeu Vizoso
Modified: 2012-10-17 23:19 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Tomeu Vizoso 2010-08-10 15:07:29 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
Comment 1 johnp 2010-10-13 18:23:33 UTC
The solution here would be to assign __gtype__ = G_TYPE_ENUM when constructing Enums
Comment 2 johnp 2010-10-13 19:53:40 UTC
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.
Comment 3 Sebastian Pölsterl 2012-04-21 13:52:29 UTC
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?
Comment 4 Akhil Laddha 2012-06-08 10:18:46 UTC
Tomeu, can you reproduce the issue with pygobject 3.2.0 or later version ?
Comment 5 Tobias Mueller 2012-10-17 23:19:55 UTC
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!