https://github.com/python/cpython/commit/e28063ef9bc5c79ab8576a7293ec97e5bd62b37a
commit: e28063ef9bc5c79ab8576a7293ec97e5bd62b37a
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2026-11-17T21:48:31+01:00
summary:
gh-162144: Skip `@nomemtest` tests when using a thread sanitizer (TSan)
(#162154)
files:
A Misc/NEWS.d/next/Tests/2026-11-17-15-57-41.gh-issue-162144.pL5k29.rst
M Lib/test/support/__init__.py
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index f69734037a8fe57..2cfe4b7f20e1015 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -1407,7 +1407,13 @@ def internal(*args, **kwargs):
import_module('_testcapi')
return test(*args, **kwargs)
- return cpython_only(internal)
+ # gh-162144: set_nomemory() and call_with_nomemory() of _testcapi are not
+ # thread safe and emit warnings when using a thread sanitizer (TSan).
+ use_tsan = check_sanitizer(thread=True)
+ reason ='not working with thread sanitizer (gh-157415)'
+ skip_if_tsan = unittest.skipIf(use_tsan, reason)
+
+ return cpython_only(skip_if_tsan(internal))
def bigaddrspacetest(f):
"""Decorator for tests that fill the address space."""
diff --git
a/Misc/NEWS.d/next/Tests/2026-11-17-15-57-41.gh-issue-162144.pL5k29.rst
b/Misc/NEWS.d/next/Tests/2026-11-17-15-57-41.gh-issue-162144.pL5k29.rst
new file mode 100644
index 000000000000000..bbd4a9cf54752e0
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2026-11-17-15-57-41.gh-issue-162144.pL5k29.rst
@@ -0,0 +1,3 @@
+Skip ``@support.nomemtest`` tests when using a thread sanitizer (TSan).
+``set_nomemory()`` and ``call_with_nomemory()`` functions of the
+:mod:`!_testcapi` extension are not thread safe. Patch by Victor Stinner.
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]