]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-151177: Fix race condition in `_testembed` (GH-151293)
authorPeter Bierma <zintensitydev@gmail.com>
Thu, 11 Jun 2026 09:06:48 +0000 (05:06 -0400)
committerGitHub <noreply@github.com>
Thu, 11 Jun 2026 09:06:48 +0000 (11:06 +0200)
Programs/_testembed.c

index 7246cc06ffff036c0543bff72896a4272c4a3b04..74d0fe37ddaeadb14e04000305ead4cd8e9aabc1 100644 (file)
@@ -2715,8 +2715,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