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

STINNER Victor report at bugs.python.org
Fri Sep 24 07:35:39 EDT 2021


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

Jeremy Maitin-Shepard: "In general, I view hanging threads as the least bad thing to do when faced with either acquiring the GIL or not returning at all.  There is a lot of existing usage of Python that currently poses a risk of random crashes and memory corruption while Python is exiting, and I would like to fix that."

Showing warnings by default or not was discussed many times in Python. It was decided to *hide* DeprecationWarning by default. The PEP 565 is a minor trade-off to show them in the __main__ module.

For me, more generally, Python default behavior is designed for *users* who don't want to be annoyed by warnings or anything which would make sense for *developers*. That's why I designed a new "Python Development Mode" (-X dev):
https://docs.python.org/dev/library/devmode.html

Maybe in development mode, the behavior could be changed to call abort(). But honestly, I'm not really excited by that. I'm not embedding Python in a C++ application. I'm almot only use Python directly: the Unix command "python3". For this use case, IMO it's fine to call pthread_exit() by default.

----------

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


More information about the Python-bugs-list mailing list