]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.15] gh-151177: Fix race condition in `_testembed` (GH-151293) (GH-151312)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 11 Jun 2026 10:10:55 +0000 (12:10 +0200)
committerGitHub <noreply@github.com>
Thu, 11 Jun 2026 10:10:55 +0000 (06:10 -0400)
gh-151177: Fix race condition in `_testembed` (GH-151293)
(cherry picked from commit f9ffca39351b77197e4dc2775a0d1e4ad64bf0e5)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Programs/_testembed.c

index 278984ddb17c1a264c5171e35d0ee04be0abf2d0..fa223c24b2e79aefbc1a5b52cf372c374131e006 100644 (file)
@@ -2710,8 +2710,8 @@ do_tstate_ensure(void *arg)
     PyThreadState_Release(tokens[2]);
     PyThreadState_Release(tokens[1]);
     PyThreadState_Release(tokens[0]);
-    PyInterpreterGuard_Close(guard);
     _Py_atomic_store_int(&data->done, 1);
+    PyInterpreterGuard_Close(guard);
 }
 
 static int