Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link
@colesbury

Description

@colesbury
Issue body actions

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

Reactions are currently unavailable

Metadata

Metadata

Assignees

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.