Skip to content

Commit 2f53c94

Browse files
committed
Update the tests.
1 parent de0e446 commit 2f53c94

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

Lib/test/test_capi/test_misc.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,17 @@ def test_no_FatalError_infinite_loop(self):
100100
_rc, out, err = run_result
101101
self.assertEqual(out, b'')
102102
# This used to cause an infinite loop.
103-
msg = ("Fatal Python error: PyThreadState_Get: "
104-
"the function must be called with the GIL held, "
105-
"after Python initialization and before Python finalization, "
106-
"but the GIL is released "
107-
"(the current Python thread state is NULL)").encode()
103+
if not support.Py_GIL_DISABLED:
104+
msg = ("Fatal Python error: PyThreadState_Get: "
105+
"the function must be called with the GIL held, "
106+
"after Python initialization and before Python finalization, "
107+
"but the GIL is released "
108+
"(the current Python thread state is NULL)").encode()
109+
else:
110+
msg = ("Fatal Python error: PyThreadState_Get: "
111+
"the function must be called with an active thread state, "
112+
"after Python initialization and before Python finalization, but it is NULL "
113+
"(are you trying to call the C API inside of a Py_BEGIN_ALLOW_THREADS block?)").encode()
108114
self.assertTrue(err.rstrip().startswith(msg),
109115
err)
110116

0 commit comments

Comments
 (0)