GNOME Bugzilla – Bug 616036
Implement proper GError handling for callbacks
Last modified: 2018-01-10 19:59:37 UTC
If one has a GError parameter to a callback function we need to handle it in a special way. If the direction is IN/INOUT: We need to convert the GError to a Python Exception (we can use this information from John E. to assist: 17:26 < jpe> zgold, look at pyglib_error_check in pygobject/pyglib.c for GError creation) and pass that exception as an argument to the python callback. If the direction is INOUT/OUT: We need to convert any python exceptions which occur to a GError and set the pointer properly. If no python exception occurs we should probably keep the GError as null.
Thank you for reporting this bug. Could you please provide a minimal test case that illustrates the issue?
Zach, can you please provide requested information as per comment#1 ?
Hey Fellas! Its been over 2 years or so since I've used GI... I'm afraid i'd be pretty useless at making a test case now. The problem is pretty straightforward though -- at a high level we want errors from one context to make sense in the other. Aka something going wrong in C should generate an appropriate python exception and visa versa.
Unless I'm missing something I think we just need to add support in the following code locations: https://git.gnome.org/browse/pygobject/tree/gi/pygi-marshal-from-py.c?h=pygobject-3-8#n1361 https://git.gnome.org/browse/pygobject/tree/gi/pygi-argument.c?h=pygobject-3-8#n1499 This should be handled during unifying/refactoring of the marshalers (bug 693405). Notice there is already code for doing all of this in other locations: https://git.gnome.org/browse/pygobject/tree/gi/pygi-argument.c?h=pygobject-3-8#n1971 https://git.gnome.org/browse/pygobject/tree/gi/pygi-marshal-to-py.c?h=pygobject-3-8#n689
*** Bug 685197 has been marked as a duplicate of this bug. ***
This should have the same code path as bug 710671 (which is changing up a bit at the moment).
-- 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/5.