]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.15] gh-146219: Document reusing a thread state across repeated foreign-thread...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 30 Jun 2026 00:12:59 +0000 (02:12 +0200)
committerGitHub <noreply@github.com>
Tue, 30 Jun 2026 00:12:59 +0000 (00:12 +0000)
commitac207265bdbcf7d507d2c9831aa54eda0fe9bb61
tree9c2f6009417d025c7b521d06e88cee999ae4dc97
parent0b273d8480ed7606f2928db33833c44673a4ad1c
[3.15] gh-146219: Document reusing a thread state across repeated foreign-thread calls (GH-146221) (#152644)

gh-146219: Document reusing a thread state across repeated foreign-thread calls (GH-146221)

* Document reusing a thread state across repeated foreign-thread calls

Add a subsection under "Non-Python created threads" explaining the
performance cost of creating/destroying a PyThreadState on every
Ensure/Release cycle and showing how to keep one alive for the
thread's lifetime instead.

* add a comma

---------
(cherry picked from commit 5717518fb3ed6f34716683e08ec372267d871d21)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Doc/c-api/threads.rst