cpython/Lib/unittest
Miss Islington (bot) 528356eac0
[3.15] gh-150175: Fix ThreadingMock call_count race condition (GH-150176) (#150182)
gh-150175: Fix ThreadingMock call_count race condition (GH-150176)

ThreadingMock._increment_mock_call() was not thread-safe.
Multiple threads calling the mock simultaneously could lose
increments due to race conditions on call_count and other
attributes.

Fix by overriding _increment_mock_call in ThreadingMixin
and wrapping it with the existing _mock_calls_events_lock.
(cherry picked from commit 388e023fe1)

Co-authored-by: saisneha196 <156835592+saisneha196@users.noreply.github.com>
2026-05-26 12:46:16 -07:00
..
__init__.py gh-126133: Only use start year in PSF copyright, remove end years (#126236) 2024-11-12 15:59:19 +02:00
__main__.py bpo-29919: Remove unused imports found by pyflakes (#137) 2017-03-27 16:05:26 +02:00
_log.py gh-134567: Add the formatter parameter in unittest.TestCase.assertLogs (GH-134570) 2025-07-02 09:51:19 +00:00
async_case.py gh-128398: improve error messages when incorrectly using with and async with (#132218) 2025-04-19 10:44:01 +02:00
case.py gh-143231: Do not swallow not matched warnings in assertWarns*() (GH-149229) 2026-05-03 10:24:57 +00:00
loader.py gh-80958: unittest: discovery support for namespace packages as start directory (#123820) 2024-10-23 13:41:33 +09:00
main.py gh-142389: Add backticks to stdlib argparse help to display in colour (#149384) 2026-05-04 22:23:18 +00:00
mock.py [3.15] gh-150175: Fix ThreadingMock call_count race condition (GH-150176) (#150182) 2026-05-26 12:46:16 -07:00
result.py gh-128595: Default to stdout isatty for colour detection instead of stderr (#128498) 2025-01-20 12:52:42 +02:00
runner.py gh-144384: Lazily import _colorize (#149318) 2026-05-06 16:07:43 +00:00
signals.py
suite.py gh-134565: Use ExceptionGroup to handle multiple errors in unittest.doModuleCleanups() (GH-134566) 2025-05-23 21:07:49 +03:00
util.py gh-145546: unittest.util: fix sorted_list_difference tail deduplication (GH-145547) 2026-03-11 13:21:22 +01:00