[issue37127] Handling pending calls during runtime finalization may cause problems.

STINNER Victor report at bugs.python.org
Wed Apr 8 17:18:03 EDT 2020


STINNER Victor <vstinner at python.org> added the comment:

I removed _pending_calls.finishing for multiple reasons:

* _PyEval_AddPendingCall() used the C API whereas the caller may not hold the GIL.
* bpo-40082: trip_signal() can be called from a thread which has no Python thread state. On Windows, CTRL+C calls trip_signal() in a new thread a each call.

I rewrote trip_signal() to only use the PyInterpreterState ("interp") and avoid PyThreadState ("tstate") in PR 19441 to fix bpo-40082.

trip_signal() should read and set atomtic variables: don't modify globals without a lock. _PyEval_AddPendingCall() is not fully async-signal safe yet :-/ Using a lock is unsafe in a signal handler.

----------

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


More information about the Python-bugs-list mailing list