mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
GH-96071: add regression test for #96071 (GH-96137)
Automerge-Triggered-By: GH:ericsnowcurrently
This commit is contained in:
parent
216ccacda1
commit
079baee196
1 changed files with 15 additions and 0 deletions
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue