Skip to content

Commit 2c02944

Browse files
Finalize PyEval_AcquireLock() and PyEval_AcquireThread() properly
1 parent 4f6b32d commit 2c02944

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

Doc/whatsnew/3.8.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,13 @@ Changes in Python behavior
725725
older Python versions include the version number, it is recommended to
726726
always use the ``sys.platform.startswith('aix')``.
727727
(Contributed by M. Felt in :issue:`36588`.)
728+
729+
* :c:func:`PyEval_AcquireLock` and :c:func:`PyEval_AcquireThread` now
730+
terminate the current thread if called while the interpreter is
731+
finalizing, making them consistent with :c:func:`PyEval_RestoreThread`,
732+
:c:func:`Py_END_ALLOW_THREADS`, and :c:func:`PyGILState_Ensure`. If this
733+
behaviour is not desired, guard the call by checking :c:func:`_Py_IsFinalizing`
734+
or :c:func:`sys.is_finalizing`.
728735

729736
Changes in the Python API
730737
-------------------------
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
:c:func:`PyEval_AcquireLock` and :c:func:`PyEval_AcquireThread` now
2+
terminate the current thread if called while the interpreter is
3+
finalizing, making them consistent with :c:func:`PyEval_RestoreThread`,
4+
:c:func:`Py_END_ALLOW_THREADS`, and :c:func:`PyGILState_Ensure`.

0 commit comments

Comments
 (0)