-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-111903: Add @critical_section
directive to Argument Clinic.
#111904
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
Conversation
The `@critical_section` directive instructs Argument Clinic to generate calls to `Py_BEGIN_CRITICAL_SECTION()` and `Py_END_CRITICAL_SECTION()` around the bound function. In `--disable-gil` builds, these calls will lock and unlock the `self` object. They are no-ops in the default build. This is used in one place (`_io._Buffered.close`) as a demonstration. Subsequent PRs will use it more widely in the `_io.Buffered` bindings.
Thanks! Can you please add tests? Also, we need to update the docs over at the devguide. Can you prepare a PR for that? |
I added two tests to |
@AlexWaygood, are you fine with the clinic.py changes? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM, sorry for the slow response! I'm not sure I fully understand what the @critical_section
does, but that's more of a documentation question -- this PR looks fine. I'll try to find some time today or tomorrow to comment on the devguide PR you've put up :)
python#111904) The `@critical_section` directive instructs Argument Clinic to generate calls to `Py_BEGIN_CRITICAL_SECTION()` and `Py_END_CRITICAL_SECTION()` around the bound function. In `--disable-gil` builds, these calls will lock and unlock the `self` object. They are no-ops in the default build. This is used in one place (`_io._Buffered.close`) as a demonstration. Subsequent PRs will use it more widely in the `_io.Buffered` bindings.
python#111904) The `@critical_section` directive instructs Argument Clinic to generate calls to `Py_BEGIN_CRITICAL_SECTION()` and `Py_END_CRITICAL_SECTION()` around the bound function. In `--disable-gil` builds, these calls will lock and unlock the `self` object. They are no-ops in the default build. This is used in one place (`_io._Buffered.close`) as a demonstration. Subsequent PRs will use it more widely in the `_io.Buffered` bindings.
The
@critical_section
directive instructs Argument Clinic to generate calls toPy_BEGIN_CRITICAL_SECTION()
andPy_END_CRITICAL_SECTION()
around the bound function. In--disable-gil
builds, these calls will lock and unlock theself
object. They are no-ops in the default build.This is used in one place (
_io._Buffered.close
) as a demonstration. Subsequent PRs will use it more widely in the_io.Buffered
bindings.Py_BEGIN_CRITICAL_SECTION()
) #111903