]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-128679: Skip test_tracemalloc_track_race() on debug build (#128988)
authorVictor Stinner <vstinner@python.org>
Sat, 18 Jan 2025 15:13:54 +0000 (16:13 +0100)
committerGitHub <noreply@github.com>
Sat, 18 Jan 2025 15:13:54 +0000 (15:13 +0000)
commit9bc19643ed54b2aa8558e87fd3a04e8bd1ea7fb2
treec541f743081ed65834520ab07534371834a35ec2
parent81159fce3643d2b5b265c441f3079166203e873e
gh-128679: Skip test_tracemalloc_track_race() on debug build (#128988)

There is a race condition between PyMem_SetAllocator() and
PyMem_RawMalloc()/PyMem_RawFree(). While PyMem_SetAllocator() write
is protected by a lock, PyMem_RawMalloc()/PyMem_RawFree() reads are
not protected by a lock. PyMem_RawMalloc()/PyMem_RawFree() can be
called with an old context and the new function pointer.

On a release build, it's not an issue since the context is not used.
On a debug build, the debug hooks use the context and so can crash.
Lib/test/test_tracemalloc.py