[issue42969] pthread_exit & PyThread_exit_thread from PyEval_RestoreThread etc. are harmful

Jeremy Maitin-Shepard report at bugs.python.org
Mon Sep 20 14:15:04 EDT 2021


Jeremy Maitin-Shepard <jeremy at jeremyms.com> added the comment:

It looks like the `_thread` module does not actually expose `PyThread_exit_thread` --- the similarly named `thread_PyThread_exit_thread` just raises SystemExit.

>From a search in the codebase, it appears `PyThread_exit_thread` is currently used only to kill threads when they attempt to acquire the GIL during finalization.

Also, if it is changed to no longer kill the thread, it would probably make sense to rename it, e.g. to `PyThread_stop_thread_during_finalization`.

----------

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


More information about the Python-bugs-list mailing list