New default SIGINT handling confuses garbage collection.
The new default SIGINT handler ( https://github.com/GNOME/pygobject/commit/58f677bfaa0f117465a9e2146c5d83768b5a76ac ) uses a callback stack which keeps pointers to a Gio.Application.quit method, preventing garbage collection on the application in python3. Try:
python TESTGC.py SIGINT
python3 TESTGC.py SIGINT
Trying to figure out how this stack evolved at runtime, I had the impression that a much more "naïve" approach would give the same results with cleaner code. Namely (almost) always install new handler, always add to / pop from stack, and only try to figure out what is really happening in two locations: I. On module initialisation, install our handler only over the default handler, II. When handler is called (so hasn't been changed yet), make sure the GLib has not installed anything either.
Side effects: adding to / popping from stack is not much more expensive than checking whether we need to, but one may be surprised to see that the default python sigint handler has changed.