Skip to content

Commit e28063e

Browse files
authored
gh-162144: Skip @nomemtest tests when using a thread sanitizer (TSan) (#162154)
1 parent c885978 commit e28063e

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

‎Lib/test/support/__init__.py‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1407,7 +1407,13 @@ def internal(*args, **kwargs):
14071407
import_module('_testcapi')
14081408
return test(*args, **kwargs)
14091409

1410-
return cpython_only(internal)
1410+
# gh-162144: set_nomemory() and call_with_nomemory() of _testcapi are not
1411+
# thread safe and emit warnings when using a thread sanitizer (TSan).
1412+
use_tsan = check_sanitizer(thread=True)
1413+
reason ='not working with thread sanitizer (gh-157415)'
1414+
skip_if_tsan = unittest.skipIf(use_tsan, reason)
1415+
1416+
return cpython_only(skip_if_tsan(internal))
14111417

14121418
def bigaddrspacetest(f):
14131419
"""Decorator for tests that fill the address space."""
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Skip ``@support.nomemtest`` tests when using a thread sanitizer (TSan).
2+
``set_nomemory()`` and ``call_with_nomemory()`` functions of the
3+
:mod:`!_testcapi` extension are not thread safe. Patch by Victor Stinner.

0 commit comments

Comments
 (0)