You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Argument Clinic: Add support for PEP 703's critical sections (Py_BEGIN_CRITICAL_SECTION()) #111903
PEP 703 in large part relies on replacing the GIL with fine grained per-object locks. The primary way to acquire and release these locks is through the critical section API (#111569). It would be helpful if argument clinic could auto generate the API calls in the binding code when specified.
For example, the bufferedio.c will require per-object locking around most calls for thread-safety in --disable-gil builds.
As an example, the _io._Buffered.close function is written as:
/*[clinic end generated code: output=7280b7b42033be0c input=d20b83d1ddd7d805]*/
We might add a @critical_section directive to designate that argument clinic should generate Py_BEGIN_CRITICAL_SECTION() and Py_END_CRITICAL_SECTION() in the binding code before calling _io__Buffered_close_impl.
Activity
corona10 commentedon Nov 9, 2023
cc @erlend-aasland
colesbury commentedon Nov 9, 2023
I've updated the issue to use AC's existing "directive" feature and syntax.
pythongh-111903: Add `@critical_section` directive to Argument Clinic.
Add "how to" for the critical_section Argument Clinic directive.
gh-111903: Add `@critical_section` directive to Argument Clinic. (#11…
Add "how to" for the critical_section Argument Clinic directive. (#1217)
pythongh-111903: Update AC to support "pycore_critical_section.h" header
pythongh-111903: Update AC to support "pycore_critical_section.h" header
gh-111903: Update AC to support "pycore_critical_section.h" header (g…
pythongh-111903: Add `@critical_section` directive to Argument Clinic. (
pythongh-111903: Update AC to support "pycore_critical_section.h" hea…
pythongh-111903: Add `@critical_section` directive to Argument Clinic. (
pythongh-111903: Update AC to support "pycore_critical_section.h" hea…