https://github.com/python/cpython/commit/a1232459860235f4fb7896cc95966d87a51cbe32
commit: a1232459860235f4fb7896cc95966d87a51cbe32
branch: main
author: Sam Gross <colesb...@gmail.com>
committer: colesbury <colesb...@gmail.com>
date: 2025-03-24T16:41:50-04:00
summary:

gh-131677: Fix flaky test_lru_cache_threaded3 (gh-131679)

The call to `with self.subTest(...)` was not thread-safe.

files:
M Lib/test/test_functools.py

diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py
index 0bbfcfd0369cf3..2b49615178f136 100644
--- a/Lib/test/test_functools.py
+++ b/Lib/test/test_functools.py
@@ -1934,8 +1934,7 @@ def f(x):
             time.sleep(.01)
             return 3 * x
         def test(i, x):
-            with self.subTest(thread=i):
-                self.assertEqual(f(x), 3 * x, i)
+            self.assertEqual(f(x), 3 * x, i)
         threads = [threading.Thread(target=test, args=(i, v))
                    for i, v in enumerate([1, 2, 2, 3, 2])]
         with threading_helper.start_threads(threads):

_______________________________________________
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