Skip to content

Commit 571e16f

Browse files
committed
Fix C API memory tests.
1 parent 55ffc32 commit 571e16f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Lib/test/test_capi/test_mem.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,13 @@ def test_api_misuse(self):
6868

6969
def check_malloc_without_gil(self, code):
7070
out = self.check(code)
71-
expected = ('Fatal Python error: _PyMem_DebugMalloc: '
72-
'Python memory allocator called without holding the GIL')
71+
if not support.Py_GIL_DISABLED:
72+
expected = ('Fatal Python error: _PyMem_DebugMalloc: '
73+
'Python memory allocator called without holding the GIL')
74+
else:
75+
expected = ('Fatal Python error: _PyMem_DebugMalloc: '
76+
'Python memory allocator called without an active thread state. '
77+
'(Are you trying to call it inside of a Py_BEGIN_ALLOW_THREADS block?)')
7378
self.assertIn(expected, out)
7479

7580
def test_pymem_malloc_without_gil(self):

0 commit comments

Comments
 (0)