GNOME Bugzilla – Bug 761101
Union type not working correctly with python 3 and GObject introspection
Last modified: 2018-01-10 20:52:41 UTC
Created attachment 319698 [details] the reproducer sources Description of problem: If I have a union type in my GObject-based code and try to use it from python 3, the right value doesn't get to the "C side". However, this works just fine with python 2. Running the attached reproducer I get this: $ GI_TYPELIB_PATH=. LD_LIBRARY_PATH=. python reproducer.py got unit with int value: 1 got unit with int value: 2 got unit with int value: 3 $ GI_TYPELIB_PATH=. LD_LIBRARY_PATH=. python3 reproducer.py got unit with int value: 1 got unit with int value: 1 got unit with int value: 1 How reproducible: 100% Steps to Reproduce: 1. unpack the attached reproducer 2. run rebuild_test_data.sh 3. run $ GI_TYPELIB_PATH=. LD_LIBRARY_PATH=. python reproducer.py 4. run $ GI_TYPELIB_PATH=. LD_LIBRARY_PATH=. python3 reproducer.py Actual results: different behaviour for python 2 (correct) and python 3 (wrong) Expected results: the same (correct) behaviour in python 3 as in python 2 Additional info: this blocks python-blivet [1] from starting to use the new libbytesize library [2] [1] https://github.com/rhinstaller/blivet [2] https://github.com/rhinstaller/libbytesize
Looks like enum access in unions isn't implemented at all and this just works by chance with Python 2.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/pygobject/issues/109.