Skip to content

Commit e3c4a5b

Browse files
[3.10] GH-96071: add regression test for GH-96071 (GH-96137) (#96205)
Co-authored-by: Kumar Aditya <[email protected]>
1 parent e783a23 commit e3c4a5b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Lib/test/test_capi.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,20 @@ def callback():
825825
t.start()
826826
t.join()
827827

828+
@threading_helper.reap_threads
829+
def test_gilstate_ensure_no_deadlock(self):
830+
# See https://github.com/python/cpython/issues/96071
831+
code = textwrap.dedent(f"""
832+
import _testcapi
833+
834+
def callback():
835+
print('callback called')
836+
837+
_testcapi._test_thread_state(callback)
838+
""")
839+
ret = assert_python_ok('-X', 'tracemalloc', '-c', code)
840+
self.assertIn(b'callback called', ret.out)
841+
828842

829843
class Test_testcapi(unittest.TestCase):
830844
locals().update((name, getattr(_testcapi, name))

0 commit comments

Comments
 (0)