Commit Graph

5 Commits

Author SHA1 Message Date
Jeong, YunWon
85eca218af Fix atexit unraisable exception message format (#7399)
* Fix atexit unraisable exception message format

Match PyErr_FormatUnraisable behavior: use
"Exception ignored in atexit callback {func!r}" as err_msg
and pass None as object instead of the callback function.

* Fix atexit unregister deadlock with reentrant __eq__

Release the lock during equality comparison in unregister so
that __eq__ can safely call atexit.unregister or atexit._clear.
Store callbacks in LIFO order (insert at front) and use
identity-based search after comparison to handle list mutations,
matching atexitmodule.c behavior.

Also pass None as err_msg when func.repr() fails, matching
CPython's PyErr_FormatUnraisable fallback.
2026-03-11 22:20:37 +09:00
Shahar Naveh
8b27eaf8f1 Update test_atexit.py to 3.14.3 (#7217) 2026-02-27 19:29:59 +09:00
Jeong Yunwon
ca84d728c2 sys.unraisablehook 2022-04-23 08:06:17 +09:00
Padraic Fanning
da40151122 Mark erroring tests 2022-02-12 15:17:50 -05:00
Padraic Fanning
c2ae3ba8d8 Add _test_atexit from CPython 3.10 2022-02-12 14:06:19 -05:00