https://github.com/python/cpython/commit/f39dea3baeb9f9b7a0199d06508d722494db0145
commit: f39dea3baeb9f9b7a0199d06508d722494db0145
branch: main
author: Nadeshiko Manju <[email protected]>
committer: ZeroIntensity <[email protected]>
date: 2025-10-01T11:34:47Z
summary:

gh-123828: Fix data race in `_interpchannels._waiting_release` (GH-124107)

files:
M Lib/test/test__interpchannels.py
M Modules/_interpchannelsmodule.c

diff --git a/Lib/test/test__interpchannels.py b/Lib/test/test__interpchannels.py
index 858d31a73cf4f4..d7cf77368ef9f2 100644
--- a/Lib/test/test__interpchannels.py
+++ b/Lib/test/test__interpchannels.py
@@ -6,7 +6,7 @@
 import time
 import unittest
 
-from test.support import import_helper, skip_if_sanitizer
+from test.support import import_helper
 
 _channels = import_helper.import_module('_interpchannels')
 from concurrent.interpreters import _crossinterp
@@ -365,7 +365,6 @@ def test_shareable(self):
         #self.assertIsNot(got, obj)
 
 
-@skip_if_sanitizer('gh-129824: race on _waiting_release', thread=True)
 class ChannelTests(TestBase):
 
     def test_create_cid(self):
diff --git a/Modules/_interpchannelsmodule.c b/Modules/_interpchannelsmodule.c
index 9c1f8615161275..274bfacfed874b 100644
--- a/Modules/_interpchannelsmodule.c
+++ b/Modules/_interpchannelsmodule.c
@@ -511,12 +511,12 @@ _waiting_release(_waiting_t *waiting, int received)
     assert(!waiting->received);
 
     waiting->status = WAITING_RELEASING;
-    PyThread_release_lock(waiting->mutex);
     if (waiting->received != received) {
         assert(received == 1);
         waiting->received = received;
     }
     waiting->status = WAITING_RELEASED;
+    PyThread_release_lock(waiting->mutex);
 }
 
 static void

_______________________________________________
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