cpython icon indicating copy to clipboard operation
cpython copied to clipboard

gh-132070: Fix PyObject_Realloc thread-safety in free threaded Python

Open colesbury opened this issue 1 week ago • 1 comments

The PyObject header reference count fields must be initialized using atomic operations because they may be concurrently read by another thread (e.g., from _Py_TryIncref).

  • Issue: gh-132070

colesbury avatar Jan 05 '26 19:01 colesbury

Reimplementing the mi_realloc logic in obmalloc.c feels a bit dirty, but it also seems better than the alternatives.

colesbury avatar Jan 05 '26 19:01 colesbury

:robot: New build scheduled with the buildbot fleet by @colesbury for commit 3387cd2415033c0e367d8303c39103594018949b :robot:

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F143441%2Fmerge

If you want to schedule another build, you need to add the :hammer: test-with-refleak-buildbots label again.

bedevere-bot avatar Jan 06 '26 18:01 bedevere-bot