Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Prev Previous commit
Next Next commit
Fix C API memory tests.
  • Loading branch information
ZeroIntensity committed Nov 27, 2024
commit 571e16f4e77b23eea2624d345418482acbe00d66
9 changes: 7 additions & 2 deletions Lib/test/test_capi/test_mem.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,13 @@ def test_api_misuse(self):

def check_malloc_without_gil(self, code):
out = self.check(code)
expected = ('Fatal Python error: _PyMem_DebugMalloc: '
'Python memory allocator called without holding the GIL')
if not support.Py_GIL_DISABLED:
expected = ('Fatal Python error: _PyMem_DebugMalloc: '
'Python memory allocator called without holding the GIL')
else:
expected = ('Fatal Python error: _PyMem_DebugMalloc: '
'Python memory allocator called without an active thread state. '
'(Are you trying to call it inside of a Py_BEGIN_ALLOW_THREADS block?)')
self.assertIn(expected, out)

def test_pymem_malloc_without_gil(self):
Expand Down