Skip to content

Commit 079baee

Browse files
authoredAug 22, 2022
GH-96071: add regression test for #96071 (GH-96137)
Automerge-Triggered-By: GH:ericsnowcurrently
1 parent 216ccac commit 079baee

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
 

‎Lib/test/test_capi.py

+15
Original file line numberDiff line numberDiff line change
@@ -1053,6 +1053,21 @@ def callback():
10531053
t.start()
10541054
t.join()
10551055

1056+
@threading_helper.reap_threads
1057+
@threading_helper.requires_working_threading()
1058+
def test_gilstate_ensure_no_deadlock(self):
1059+
# See https://github.com/python/cpython/issues/96071
1060+
code = textwrap.dedent(f"""
1061+
import _testcapi
1062+
1063+
def callback():
1064+
print('callback called')
1065+
1066+
_testcapi._test_thread_state(callback)
1067+
""")
1068+
ret = assert_python_ok('-X', 'tracemalloc', '-c', code)
1069+
self.assertIn(b'callback called', ret.out)
1070+
10561071

10571072
class Test_testcapi(unittest.TestCase):
10581073
locals().update((name, getattr(_testcapi, name))

0 commit comments

Comments
 (0)