https://github.com/python/cpython/commit/b8d808ddd77f84de9f93adcc2aede2879eb5241e
commit: b8d808ddd77f84de9f93adcc2aede2879eb5241e
branch: main
author: Antoine Pitrou <anto...@python.org>
committer: pitrou <pit...@free.fr>
date: 2024-03-17T09:47:14+01:00
summary:

GH-112536: Add more TSan tests (#116911)

These may all exercise some non-trivial aspects of thread synchronization.

files:
M Lib/test/libregrtest/tsan.py
M Modules/_testinternalcapi.c

diff --git a/Lib/test/libregrtest/tsan.py b/Lib/test/libregrtest/tsan.py
index c5aed436b829d1..dd18ae2584f5d8 100644
--- a/Lib/test/libregrtest/tsan.py
+++ b/Lib/test/libregrtest/tsan.py
@@ -2,6 +2,9 @@
 # chosen because they use threads and run in a reasonable amount of time.
 
 TSAN_TESTS = [
+    # TODO: enable more of test_capi once bugs are fixed (GH-116908, 
GH-116909).
+    'test_capi.test_mem',
+    'test_capi.test_pyatomic',
     'test_code',
     'test_enum',
     'test_functools',
@@ -11,6 +14,9 @@
     'test_io',
     'test_logging',
     'test_queue',
+    'test_signal',
+    'test_socket',
+    'test_sqlite3',
     'test_ssl',
     'test_syslog',
     'test_thread',
diff --git a/Modules/_testinternalcapi.c b/Modules/_testinternalcapi.c
index b3076a8f548b62..1c10dd02138f3a 100644
--- a/Modules/_testinternalcapi.c
+++ b/Modules/_testinternalcapi.c
@@ -1287,8 +1287,8 @@ check_pyobject_forbidden_bytes_is_freed(PyObject *self,
 static PyObject *
 check_pyobject_freed_is_freed(PyObject *self, PyObject *Py_UNUSED(args))
 {
-    /* This test would fail if run with the address sanitizer */
-#ifdef _Py_ADDRESS_SANITIZER
+    /* ASan or TSan would report an use-after-free error */
+#if defined(_Py_ADDRESS_SANITIZER) || defined(_Py_THREAD_SANITIZER)
     Py_RETURN_NONE;
 #else
     PyObject *op = PyObject_CallNoArgs((PyObject *)&PyBaseObject_Type);

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to