Skip to content

Commit

Permalink
pythonGH-96071: add regression test for python#96071 (pythonGH-96137)
Browse files Browse the repository at this point in the history
Automerge-Triggered-By: GH:ericsnowcurrently
  • Loading branch information
kumaraditya303 authored Aug 22, 2022
1 parent 216ccac commit 079baee
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Lib/test/test_capi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,21 @@ def callback():
t.start()
t.join()

@threading_helper.reap_threads
@threading_helper.requires_working_threading()
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))
Expand Down

0 comments on commit 079baee

Please sign in to comment.