]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-133296: Publicly expose critical section API that accepts PyMutex (gh-135899)
authorNathan Goldbaum <nathan.goldbaum@gmail.com>
Mon, 21 Jul 2025 21:25:43 +0000 (15:25 -0600)
committerGitHub <noreply@github.com>
Mon, 21 Jul 2025 21:25:43 +0000 (17:25 -0400)
commit89c220b93c06059f623e2d232bd54f49be1be22d
treee8ea4528b25c29d63576c1c75fb2ff729a6b225e
parentf183996eb77fd2d5662c62667298c292c943ebf5
gh-133296: Publicly expose critical section API that accepts PyMutex (gh-135899)

This makes the following APIs public:

* `Py_BEGIN_CRITICAL_SECTION_MUTEX(mutex),`
* `Py_BEGIN_CRITICAL_SECTION2_MUTEX(mutex1, mutex2)`
* `void PyCriticalSection_BeginMutex(PyCriticalSection *c, PyMutex *mutex)`
* `void PyCriticalSection2_BeginMutex(PyCriticalSection2 *c, PyMutex *mutex1, PyMutex *mutex2)`

The macros are identical to the corresponding `Py_BEGIN_CRITICAL_SECTION` and
`Py_BEGIN_CRITICAL_SECTION2` macros (e.g., they include braces), but they
accept a `PyMutex` instead of an object.

The new macros are still paired with the existing END macros
(`Py_END_CRITICAL_SECTION`, `Py_END_CRITICAL_SECTION2`).
Doc/c-api/init.rst
Include/cpython/critical_section.h
Include/internal/pycore_critical_section.h
Misc/NEWS.d/next/C_API/2025-06-24-11-10-01.gh-issue-133296.lIEuVJ.rst [new file with mode: 0644]
Modules/_ctypes/ctypes.h
Modules/_testcapimodule.c
Objects/typeobject.c
Python/critical_section.c