Skip to content

Commit 0aed1e7

Browse files
GH-96071: add regression test for GH-96071 (GH-96137)
Automerge-Triggered-By: GH:ericsnowcurrently (cherry picked from commit 079baee) Co-authored-by: Kumar Aditya <[email protected]>
1 parent 27950d8 commit 0aed1e7

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Diff for: Lib/test/test_capi.py

+15
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,21 @@ def callback():
915915
t.start()
916916
t.join()
917917

918+
@threading_helper.reap_threads
919+
@threading_helper.requires_working_threading()
920+
def test_gilstate_ensure_no_deadlock(self):
921+
# See https://github.com/python/cpython/issues/96071
922+
code = textwrap.dedent(f"""
923+
import _testcapi
924+
925+
def callback():
926+
print('callback called')
927+
928+
_testcapi._test_thread_state(callback)
929+
""")
930+
ret = assert_python_ok('-X', 'tracemalloc', '-c', code)
931+
self.assertIn(b'callback called', ret.out)
932+
918933

919934
class Test_testcapi(unittest.TestCase):
920935
locals().update((name, getattr(_testcapi, name))

0 commit comments

Comments
 (0)