[issue25489] sys.exit() caught in exception handler

Guido van Rossum report at bugs.python.org
Sun Mar 20 12:39:17 EDT 2022


Guido van Rossum <guido at python.org> added the comment:

With python built from main I get:

/Users/guido/test_sys_exit_in_exception_handler.py:12: DeprecationWarning: There is no current event loop
  loop = asyncio.get_event_loop()
Got error, exiting
Exception ignored in: <bound method BaseEventLoop.call_exception_handler of <_UnixSelectorEventLoop running=True closed=False debug=False>>
Traceback (most recent call last):
  File "/Users/guido/cpython/Lib/asyncio/base_events.py", line 1749, in call_exception_handler
    self._exception_handler(self, context)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/guido/test_sys_exit_in_exception_handler.py", line 6, in handler
    sys.exit(42)
    ^^^^^^^^^^^^
SystemExit: 42


This is printed from write_unraisable_exc_file(). Earlier comments in this issue indicate that the exception is being raised from a finalizer (__del__ method). But how?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue25489>
_______________________________________


More information about the Python-bugs-list mailing list