Content-Length: 297271 | pFad | http://github.com/python/cpython/pull/136969

C2 [3.14] gh-133296: Publicly expose critical section API that accepts PyMutex (gh-135899) by miss-islington · Pull Request #136969 · python/cpython · GitHub
Skip to content

[3.14] gh-133296: Publicly expose critical section API that accepts PyMutex (gh-135899) #136969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 22, 2025

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Jul 22, 2025

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).
(cherry picked from commit 89c220b)

Co-authored-by: Nathan Goldbaum nathan.goldbaum@gmail.com


📚 Documentation preview 📚: https://cpython-previews--136969.org.readthedocs.build/

…Mutex (pythongh-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`).
(cherry picked from commit 89c220b)

Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
@hugovk hugovk merged commit 11f5101 into python:3.14 Jul 22, 2025
42 checks passed
@ambv
Copy link
Contributor

ambv commented Jul 22, 2025

This extends the ABI over what we had in the last beta. This is walking a thin line of our rule that we don't break the ABI after the last beta. It's fine since it doesn't break existing built wheel binaries, but we need to be careful not to combine this with any change that would affect the ABI. The renaming of the macros is fortunately not a concern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/python/cpython/pull/136969

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy