Skip to content
Commit 8694e4dd authored by Dan Nicholson's avatar Dan Nicholson Committed by Simon Feltman
Browse files

Handle exception unreffing Variant at exit

Calling unref will cause gi and gi.repository.GLib to be imported.
However, if the program is exiting, then these modules have likely been
removed from sys.modules and will raise an exception. Assume that's the
case for ImportError and ignore the exception since everything will be
cleaned up, anyways.

This can be triggered with the following trivial program:

$ python3 -c 'from gi.repository import GLib; v = GLib.Variant("s", "foo")'
Exception ignored in:

Adding some debug code to show the full exception revealed this:

Traceback (most recent call last):
  File "/home/dan/src/pygobject/build3/gi/overrides/GLib.py", line 265, in __del__
    self.unref()
ImportError: import of 'gi.repository.GLib' halted; None in sys.modules

https://bugzilla.gnome.org/show_bug.cgi?id=776092
parent 54c623ba
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment