diff --git a/Lib/test/test_capi/test_mem.py b/Lib/test/test_capi/test_mem.py index 6ab7b685c2e18b..0c2963cf6fa8c6 100644 --- a/Lib/test/test_capi/test_mem.py +++ b/Lib/test/test_capi/test_mem.py @@ -1,8 +1,8 @@ import re +import sys import textwrap import unittest - from test import support from test.support import import_helper, requires_subprocess from test.support.script_helper import assert_python_failure, assert_python_ok @@ -75,12 +75,20 @@ def check_malloc_without_gil(self, code): def test_pymem_malloc_without_gil(self): # Debug hooks must raise an error if PyMem_Malloc() is called # without holding the GIL + if support.check_sanitizer(thread=True) and sys.platform == 'darwin': + # See: gh-120696 + raise unittest.SkipTest("this test will hang on macOS with TSAN") + code = 'import _testcapi; _testcapi.pymem_malloc_without_gil()' self.check_malloc_without_gil(code) def test_pyobject_malloc_without_gil(self): # Debug hooks must raise an error if PyObject_Malloc() is called # without holding the GIL + if support.check_sanitizer(thread=True) and sys.platform == 'darwin': + # See: gh-120696 + raise unittest.SkipTest("this test will hang on macOS with TSAN") + code = 'import _testcapi; _testcapi.pyobject_malloc_without_gil()' self.check_malloc_without_gil(code)