]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-119344: Make critical section API public (GH-119353) (#120856)
authorSam Gross <colesbury@gmail.com>
Fri, 21 Jun 2024 20:20:41 +0000 (16:20 -0400)
committerGitHub <noreply@github.com>
Fri, 21 Jun 2024 20:20:41 +0000 (20:20 +0000)
commit4dc27bc0b76aa5985ccef2901f7a4f5d36b97995
tree3219748fd1c47dec959096aed7457cf1fad5d43a
parente748805f2a0f783723ef02809f86cd3d8fb8bf2e
[3.13] gh-119344: Make critical section API public (GH-119353) (#120856)

This makes the following macros public as part of the non-limited C-API for
locking a single object or two objects at once.

* `Py_BEGIN_CRITICAL_SECTION(op)` / `Py_END_CRITICAL_SECTION()`
* `Py_BEGIN_CRITICAL_SECTION2(a, b)` / `Py_END_CRITICAL_SECTION2()`

The supporting functions and structs used by the macros are also exposed for
cases where C macros are not available.
(cherry picked from commit 8f17d69b7bc906e8407095317842cc0fd52cd84a)
15 files changed:
Doc/c-api/init.rst
Include/Python.h
Include/cpython/critical_section.h [new file with mode: 0644]
Include/critical_section.h [new file with mode: 0644]
Include/internal/pycore_critical_section.h
Makefile.pre.in
Misc/NEWS.d/next/C API/2024-05-21-19-41-41.gh-issue-119344.QKvzQb.rst [new file with mode: 0644]
Modules/_sre/sre.c
Modules/_testcapimodule.c
Objects/dictobject.c
Objects/listobject.c
Objects/typeobject.c
PCbuild/pythoncore.vcxproj
PCbuild/pythoncore.vcxproj.filters
Python/critical_section.c