summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorSam Gross <colesbury@gmail.com>2024-03-19 18:40:20 (GMT)
committerGitHub <noreply@github.com>2024-03-19 18:40:20 (GMT)
commit60e105c1c11ecca1680d03c38aa06bcc77a28714 (patch)
treeec314b15b7739ae1f0c463ebd47cff1d06b4260e /Objects/unicodeobject.c
parent025ef7a5f7b424fba8713e448244b952bf897df3 (diff)
downloadcpython-60e105c1c11ecca1680d03c38aa06bcc77a28714.zip
cpython-60e105c1c11ecca1680d03c38aa06bcc77a28714.tar.gz
cpython-60e105c1c11ecca1680d03c38aa06bcc77a28714.tar.bz2
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.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index c8f647a..e412af5 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -505,7 +505,7 @@ unicode_check_encoding_errors(const char *encoding, const char *errors)
/* Disable checks during Python finalization. For example, it allows to
call _PyObject_Dump() during finalization for debugging purpose. */
- if (interp->finalizing) {
+ if (_PyInterpreterState_GetFinalizing(interp) != NULL) {
return 0;
}