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 616036 - Implement proper GError handling for callbacks
Implement proper GError handling for callbacks
Status: RESOLVED OBSOLETE
Product: pygobject
Classification: Bindings
Component: introspection
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on: 710671
Blocks:
 
 
Reported: 2010-04-17 15:28 UTC by Zach Goldberg
Modified: 2018-01-10 19:59 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Zach Goldberg 2010-04-17 15:28:46 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.
Comment 1 Sebastian Pölsterl 2012-04-23 18:58:31 UTC
Thank you for reporting this bug. Could you please provide a minimal test case that illustrates the issue?
Comment 2 Akhil Laddha 2012-06-08 10:17:49 UTC
Zach, can you please provide requested information as per comment#1 ?
Comment 3 Zach Goldberg 2012-06-08 11:22:17 UTC
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.
Comment 4 Simon Feltman 2013-04-19 11:09:28 UTC
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
Comment 5 Simon Feltman 2013-08-14 20:35:10 UTC
*** Bug 685197 has been marked as a duplicate of this bug. ***
Comment 6 Simon Feltman 2014-08-06 05:03:02 UTC
This should have the same code path as bug 710671 (which is changing up a bit at the moment).
Comment 7 GNOME Infrastructure Team 2018-01-10 19:59:37 UTC
-- 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.