https://github.com/python/cpython/commit/491768da4c7ffcc38809724d4d9c4a67e7131b9d
commit: 491768da4c7ffcc38809724d4d9c4a67e7131b9d
branch: 3.15
author: Miss Islington (bot) <[email protected]>
committer: ZeroIntensity <[email protected]>
date: 2026-06-11T06:10:55-04:00
summary:

[3.15] gh-151177: Fix race condition in `_testembed` (GH-151293) (GH-151312)

gh-151177: Fix race condition in `_testembed` (GH-151293)
(cherry picked from commit f9ffca39351b77197e4dc2775a0d1e4ad64bf0e5)

Co-authored-by: Peter Bierma <[email protected]>

files:
M Programs/_testembed.c

diff --git a/Programs/_testembed.c b/Programs/_testembed.c
index 278984ddb17c1a2..fa223c24b2e79ae 100644
--- a/Programs/_testembed.c
+++ b/Programs/_testembed.c
@@ -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

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to