Skip to content

Commit

Permalink
[3.10] pythonGH-96071: add regression test for pythonGH-96071 (python…
Browse files Browse the repository at this point in the history
…GH-96137)

Automerge-Triggered-By: GH:ericsnowcurrently
(cherry picked from commit 079baee)

Co-authored-by: Kumar Aditya <[email protected]>
  • Loading branch information
kumaraditya303 authored Aug 23, 2022
1 parent 9c34d64 commit 10e5d8b
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 @@ -825,6 +825,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 10e5d8b

Please sign in to comment.