[issue36427] Document that PyEval_RestoreThread and PyGILState_Ensure can terminate the calling thread

2019-04-13 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue36427] Document that PyEval_RestoreThread and PyGILState_Ensure can terminate the calling thread

2019-04-13 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: New changeset 7723d0545c3369e1b2601b207c250c70ce90b75e by Pablo Galindo in branch '3.7': [3.7] bpo-36427: Document that PyEval_RestoreThread and PyGILState_Ensure can terminate the calling thread (GH-12541) (GH-12820)

[issue36427] Document that PyEval_RestoreThread and PyGILState_Ensure can terminate the calling thread

2019-04-13 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- pull_requests: +12745 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36427] Document that PyEval_RestoreThread and PyGILState_Ensure can terminate the calling thread

2019-04-13 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: New changeset fde9b33dfeedd4a4ed723b12d2330979dc684760 by Pablo Galindo in branch 'master': bpo-36427: Document that PyEval_RestoreThread and PyGILState_Ensure can terminate the calling thread (GH-12541)

[issue36427] Document that PyEval_RestoreThread and PyGILState_Ensure can terminate the calling thread

2019-03-29 Thread Eric Snow
Eric Snow added the comment: > Currently PyEval_RestoreThread and its callers (mainly PyGILState_Ensure) > can terminate the thread if the interpreter is finalizing: s/interpreter/runtime/ Most likely (guaranteed?) it will be in the main interpreter, but it is actually not triggered by

[issue36427] Document that PyEval_RestoreThread and PyGILState_Ensure can terminate the calling thread

2019-03-29 Thread Eric Snow
Eric Snow added the comment: > > if (_Py_IsFinalizing() && !_Py_CURRENTLY_FINALIZING(tstate)) > > _Py_IsFinalizing() check is redundant :-) Not really: * _Py_IsFinalizing() checks if the runtime is finalizing * _Py_CURRENTLY_FINALIZING checks if the current thread is the one running

[issue36427] Document that PyEval_RestoreThread and PyGILState_Ensure can terminate the calling thread

2019-03-29 Thread Eric Snow
Eric Snow added the comment: Related: * #36475: "PyEval_AcquireLock() and PyEval_AcquireThread() do not handle runtime finalization properly." * #36476: "Runtime finalization assumes all other threads have exited." -- ___ Python tracker

[issue36427] Document that PyEval_RestoreThread and PyGILState_Ensure can terminate the calling thread

2019-03-25 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: > Right. It was just a general comment :-) Yep, daemon threads are evil :) -- ___ Python tracker ___

[issue36427] Document that PyEval_RestoreThread and PyGILState_Ensure can terminate the calling thread

2019-03-25 Thread STINNER Victor
STINNER Victor added the comment: > Well, given that this happens as well in Python3.7 and before, at least we > should document it and we can think about changing it in the future. But for > now, but I suggest keeping both PRs separated (in case we really want to > change anything).

[issue36427] Document that PyEval_RestoreThread and PyGILState_Ensure can terminate the calling thread

2019-03-25 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: > I really dislike the design of daemon threads. If it would be only me, I > would prefer this nasty feature causing so much issues at Python shutdown. Well, given that this happens as well in Python3.7 and before, at least we should document it and

[issue36427] Document that PyEval_RestoreThread and PyGILState_Ensure can terminate the calling thread

2019-03-25 Thread STINNER Victor
STINNER Victor added the comment: > This behaviour that protects against problems due to daemon threads > registered with the interpreter can be *very* surprising for C-extensions > that are using these functions to implement callbacks that can call into > Python. I really dislike the

[issue36427] Document that PyEval_RestoreThread and PyGILState_Ensure can terminate the calling thread

2019-03-25 Thread STINNER Victor
STINNER Victor added the comment: > if (_Py_IsFinalizing() && !_Py_CURRENTLY_FINALIZING(tstate)) _Py_IsFinalizing() check is redundant :-) -- ___ Python tracker ___

[issue36427] Document that PyEval_RestoreThread and PyGILState_Ensure can terminate the calling thread

2019-03-25 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- keywords: +patch pull_requests: +12490 stage: -> patch review ___ Python tracker ___ ___

[issue36427] Document that PyEval_RestoreThread and PyGILState_Ensure can terminate the calling thread

2019-03-25 Thread Pablo Galindo Salgado
New submission from Pablo Galindo Salgado : Currently PyEval_RestoreThread and its callers (mainly PyGILState_Ensure) can terminate the thread if the interpreter is finalizing: PyEval_RestoreThread(PyThreadState *tstate) { if (tstate == NULL) Py_FatalError("PyEval_RestoreThread: