https://github.com/python/cpython/commit/f9ffca39351b77197e4dc2775a0d1e4ad64bf0e5
commit: f9ffca39351b77197e4dc2775a0d1e4ad64bf0e5
branch: main
author: Peter Bierma <[email protected]>
committer: encukou <[email protected]>
date: 2026-06-11T11:06:48+02:00
summary:

gh-151177: Fix race condition in `_testembed` (GH-151293)

files:
M Programs/_testembed.c

diff --git a/Programs/_testembed.c b/Programs/_testembed.c
index 7246cc06ffff036..74d0fe37ddaeadb 100644
--- a/Programs/_testembed.c
+++ b/Programs/_testembed.c
@@ -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

_______________________________________________
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