Skip to content

Commit ca71c22

Browse files
vstinnermiss-islington
authored andcommitted
gh-162144: Skip @nomemtest tests when using a thread sanitizer (TSan) (GH-162154)
(cherry picked from commit e28063e) Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent f12e44a commit ca71c22

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
@@ -1242,7 +1242,13 @@ def internal(*args, **kwargs):
12421242
import_module('_testcapi')
12431243
return test(*args, **kwargs)
12441244

1245-
return cpython_only(internal)
1245+
# gh-162144: set_nomemory() and call_with_nomemory() of _testcapi are not
1246+
# thread safe and emit warnings when using a thread sanitizer (TSan).
1247+
use_tsan = check_sanitizer(thread=True)
1248+
reason ='not working with thread sanitizer (gh-157415)'
1249+
skip_if_tsan = unittest.skipIf(use_tsan, reason)
1250+
1251+
return cpython_only(skip_if_tsan(internal))
12461252

12471253
def bigaddrspacetest(f):
12481254
"""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)