summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-02-01 01:30:25 (GMT)
committerGitHub <noreply@github.com>2020-02-01 01:30:25 (GMT)
commit4d96b4635aeff1b8ad41d41422ce808ce0b971c8 (patch)
tree841398922264fff5b99548bee68ff70884554040 /Misc
parent7dc140126e918cc7c6e65aea321b7255f0020798 (diff)
downloadcpython-4d96b4635aeff1b8ad41d41422ce808ce0b971c8.zip
cpython-4d96b4635aeff1b8ad41d41422ce808ce0b971c8.tar.gz
cpython-4d96b4635aeff1b8ad41d41422ce808ce0b971c8.tar.bz2
bpo-39511: PyThreadState_Clear() calls on_delete (GH-18296)
PyThreadState.on_delete is a callback used to notify Python when a thread completes. _thread._set_sentinel() function creates a lock which is released when the thread completes. It sets on_delete callback to the internal release_sentinel() function. This lock is known as Threading._tstate_lock in the threading module. The release_sentinel() function uses the Python C API. The problem is that on_delete is called late in the Python finalization, when the C API is no longer fully working. The PyThreadState_Clear() function now calls the PyThreadState.on_delete callback. Previously, that happened in PyThreadState_Delete(). The release_sentinel() function is now called when the C API is still fully working.
Diffstat (limited to 'Misc')
-rw-r--r--Misc/NEWS.d/next/C API/2020-01-31-16-35-21.bpo-39511.nv9yEn.rst3
1 files changed, 3 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/C API/2020-01-31-16-35-21.bpo-39511.nv9yEn.rst b/Misc/NEWS.d/next/C API/2020-01-31-16-35-21.bpo-39511.nv9yEn.rst
new file mode 100644
index 0000000..14a0487
--- /dev/null
+++ b/Misc/NEWS.d/next/C API/2020-01-31-16-35-21.bpo-39511.nv9yEn.rst
@@ -0,0 +1,3 @@
+The :c:func:`PyThreadState_Clear` function now calls the
+:c:member:`PyThreadState.on_delete` callback. Previously, that happened in
+:c:func:`PyThreadState_Delete`.