SIGN IN SIGN UP

gh-113964: Don't prevent new threads until all non-daemon threads exit (#116677)

Starting in Python 3.12, we prevented calling fork() and starting new threads
during interpreter finalization (shutdown). This has led to a number of
regressions and flaky tests. We should not prevent starting new threads
(or `fork()`) until all non-daemon threads exit and finalization starts in
earnest.

This changes the checks to use `_PyInterpreterState_GetFinalizing(interp)`,
which is set immediately before terminating non-daemon threads.
S
Sam Gross committed
60e105c1c11ecca1680d03c38aa06bcc77a28714
Parent: 025ef7a
Committed by GitHub <noreply@github.com> on 3/19/2024, 6:40:20 PM