Skip to content
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

Support specifying object to lock in Argument Clinic's @critical_section directive #112213

Closed
Tracked by #108219
colesbury opened this issue Nov 17, 2023 · 1 comment
Closed
Tracked by #108219
Assignees
Labels
3.13 bugs and security fixes topic-argument-clinic topic-free-threading type-feature A feature request or enhancement

Comments

@colesbury
Copy link
Contributor

colesbury commented Nov 17, 2023

Feature or enhancement

#111903 added support for the @critical_section directive to Argument Clinic. It currently assumes that the first argument is the one that should be locked. This is a good default, but there are at least a few cases where we want to lock a different argument.

For example, in the _weakref module, we generally want to lock the object argument, not the _weakref module itself.

Let's add support for specifying the argument to lock. For example,

/*[clinic input]
@critical_section object
_weakref.getweakrefs
    object: object
    /

Return a list of all weak reference objects pointing to 'object'.
[clinic start generated code]*/

static PyObject *
_weakref_getweakrefs(PyObject *module, PyObject *object)
/*[clinic end generated code: output=25c7731d8e011824 input=00c6d0e5d3206693]*/

Linked PRs

@colesbury colesbury added type-feature A feature request or enhancement topic-argument-clinic 3.13 bugs and security fixes topic-free-threading labels Nov 17, 2023
@colesbury
Copy link
Contributor Author

cc @corona10 (motivated by #112189) and @erlend-aasland

corona10 added a commit to corona10/cpython that referenced this issue Nov 18, 2023
corona10 added a commit that referenced this issue Nov 18, 2023
corona10 added a commit to corona10/cpython that referenced this issue Nov 18, 2023
corona10 added a commit to corona10/cpython that referenced this issue Nov 19, 2023
corona10 added a commit to corona10/cpython that referenced this issue Nov 19, 2023
corona10 added a commit to corona10/cpython that referenced this issue Nov 24, 2023
corona10 added a commit that referenced this issue Nov 24, 2023
)


Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
…linic (pythongh-112232)


Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
…linic (pythongh-112232)


Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes topic-argument-clinic topic-free-threading type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants