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

Adapt sys.audit() to Argument Clinic #126579

Closed
serhiy-storchaka opened this issue Nov 8, 2024 · 2 comments
Closed

Adapt sys.audit() to Argument Clinic #126579

serhiy-storchaka opened this issue Nov 8, 2024 · 2 comments
Labels
3.14 new features, bugs and security fixes topic-argument-clinic

Comments

@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Nov 8, 2024

It requoired support of var-positional parameters, which are now supported.

Linked PRs

@serhiy-storchaka serhiy-storchaka added topic-argument-clinic 3.14 new features, bugs and security fixes labels Nov 8, 2024
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Nov 8, 2024
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Nov 8, 2024
@erlend-aasland erlend-aasland changed the title Convert sys.audit() to Argument Clinic Adapt sys.audit() to Argument Clinic Nov 8, 2024
@skirpichev
Copy link
Member

I think there are more cases:

$ git grep '($[a-z].*, \*[a-z]'|fgrep -v _testclinic|fgrep -v test/|fgrep -v clinic/
Modules/_operator.c:"call($module, obj, /, *args, **kwargs)\n"
Modules/_threadmodule.c:"__exit__($self, /, *exc_info)\n\
Modules/_threadmodule.c:"__exit__($self, /, *exc_info)\n\
Modules/atexitmodule.c:"register($module, func, /, *args, **kwargs)\n\
Objects/memoryobject.c:             "__exit__($self, /, *exc_info)\n--\n\n"
Objects/typeobject.c:     PyDoc_STR("__new__($type, *args, **kwargs)\n--\n\n"
Objects/typeobject.c:           "__call__($self, /, *args, **kwargs)\n--\n\nCall self as a function.",
Objects/typeobject.c:           "__init__($self, /, *args, **kwargs)\n--\n\n"
Objects/unicodeobject.c:             "format($self, /, *args, **kwargs)\n\
Python/bltinmodule.c:"breakpoint($module, /, *args, **kws)\n\
Python/sysmodule.c:"audit($module, event, /, *args)\n\
Python/sysmodule.c:"breakpointhook($module, /, *args, **kwargs)\n"

@serhiy-storchaka
Copy link
Member Author

In __exit__ methods, *exc_info is a shortcut for three positional-only parameters, values of which are ignored. Other functions require support of a var-keyword parameter.

There are other builtins which can be converted (i just wrote the code), but they first need support of multisignatures to utilize the full power of Argument Clinic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.14 new features, bugs and security fixes topic-argument-clinic
Projects
None yet
Development

No branches or pull requests

2 participants