| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
Did this API got an exception to be added to Python 3.13?
Sorry, something went wrong.
| // Python releases without a deprecation period. | ||
| struct PyCriticalSection { | ||
| // Tagged pointer to an outer active critical section (or 0). | ||
| uintptr_t _prev; |
There was a problem hiding this comment.
Would it be possible to add "cs_" in the name? It helps refactoring and to navigate in the code.
Same suggestion for PyCriticalSection2.
Sorry, something went wrong.
There was a problem hiding this comment.
I've renamed the fields
Sorry, something went wrong.
| # error "this header file must not be included directly" | ||
| #endif | ||
|
|
||
| // Python critical sections |
There was a problem hiding this comment.
Maybe move this doc to Doc/c-api/init.rst, or merge it with Doc/c-api/init.rst?
Sorry, something went wrong.
There was a problem hiding this comment.
I think the file documentation is still useful even with the public Doc/c-api/init.rst docs. The file docs talk more about specific internals like PyThreadState.critical_section.
Sorry, something went wrong.
There was a problem hiding this comment.
Looks good, thank you! I have a few suggestions for the docs:
Sorry, something went wrong.
|
|
||
| .. versionadded:: 3.13 | ||
|
|
||
| Python Critical Section API |
There was a problem hiding this comment.
Mabye add a label for easy referencing in the future.
Sorry, something went wrong.
There was a problem hiding this comment.
I've added a label
Sorry, something went wrong.
Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Victor Stinner <vstinner@python.org>
|
@Yhg1s - this PR makes the critical section API public. Is it acceptable to include this in 3.13? There's a bunch of refactoring to make the API public, but no new functionality. |
Sorry, something went wrong.
|
Yes, this can go into 3.13 if it gets into beta 3. (How many more APIs do you think we'll need for 3.13? :P) |
Sorry, something went wrong.
|
This is the last one, I promise! |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM, thanks for the update.
Sorry, something went wrong.
|
Thanks @colesbury for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Sorry, something went wrong.
|
Sorry, @colesbury, I could not cleanly backport this to 3.13 due to a conflict. cherry_picker 8f17d69b7bc906e8407095317842cc0fd52cd84a 3.13 |
Sorry, something went wrong.
…9353) 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 8f17d69) Co-authored-by: Sam Gross <colesbury@gmail.com>
|
GH-120856 is a backport of this pull request to the 3.13 branch. |
Sorry, something went wrong.
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 8f17d69)
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.
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.
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.
| Back | FazBrowse Home | New Git URL |
This makes the following macros public as part of the non-limited C-API for locking a single object or two objects at once.
The following supporting functions and types are also public for use by bindings from other languages:
Note that the more esoteric APIs are still internal-only as part of pycore_critical_section.h.
See also C-API WG Issue:
Docs: