SIGN IN SIGN UP
python / cpython UNCLAIMED

The Python programming language

72140 0 27 Python

gh-125053: Document that ob_mutex must only be used via critical section API (#144599)

Add a warning in the free-threading extensions howto explaining that
PyObject.ob_mutex is reserved for the critical section API and must not
be locked directly with PyMutex_Lock, as this can cause deadlocks.
Extension authors who need their own lock should add a separate PyMutex
field to their object struct.

Also add an ob_mutex member entry under PyObject in the C API reference
(Doc/c-api/structures.rst) with a cross-reference to the howto.

Co-authored-by: Victor Stinner <vstinner@python.org>
F
Farhan Saif committed
bf4017b16149ba17d723abacfe93aec79b2235fe
Parent: 2756d56
Committed by GitHub <noreply@github.com> on 3/10/2026, 4:23:39 PM