[Python-checkins] [3.10] GH-96071: add regression test for GH-96071 (GH-96137) (#96205)

pablogsal webhook-mailer at python.org
Tue Aug 23 18:28:59 EDT 2022


https://github.com/python/cpython/commit/e3c4a5b8ede2f239c8a3de5e0f0a755b67f6c324
commit: e3c4a5b8ede2f239c8a3de5e0f0a755b67f6c324
branch: 3.10
author: Kumar Aditya <59607654+kumaraditya303 at users.noreply.github.com>
committer: pablogsal <Pablogsal at gmail.com>
date: 2022-08-23T23:28:54+01:00
summary:

[3.10] GH-96071: add regression test for GH-96071 (GH-96137) (#96205)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303 at users.noreply.github.com>

files:
M Lib/test/test_capi.py

diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py
index 7b208c90063..0adb689beb8 100644
--- a/Lib/test/test_capi.py
+++ b/Lib/test/test_capi.py
@@ -825,6 +825,20 @@ def callback():
         t.start()
         t.join()
 
+    @threading_helper.reap_threads
+    def test_gilstate_ensure_no_deadlock(self):
+        # See https://github.com/python/cpython/issues/96071
+        code = textwrap.dedent(f"""
+            import _testcapi
+
+            def callback():
+                print('callback called')
+
+            _testcapi._test_thread_state(callback)
+            """)
+        ret = assert_python_ok('-X', 'tracemalloc', '-c', code)
+        self.assertIn(b'callback called', ret.out)
+
 
 class Test_testcapi(unittest.TestCase):
     locals().update((name, getattr(_testcapi, name))



More information about the Python-checkins mailing list