-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
Argument Clinic: Unsafe code generation with defining_class
and no slash
#117613
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
Labels
Comments
Yes, Argument Clinic should explicitly check that |
Hm, we should already be checking that. So, perhaps that check is malfunctioning. |
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Apr 15, 2024
vstinner
added a commit
that referenced
this issue
Apr 16, 2024
erlend-aasland
pushed a commit
that referenced
this issue
Apr 16, 2024
This was referenced Apr 16, 2024
Merged
diegorusso
pushed a commit
to diegorusso/cpython
that referenced
this issue
Apr 17, 2024
diegorusso
pushed a commit
to diegorusso/cpython
that referenced
this issue
Apr 17, 2024
… are positional-only (python#117781)
erlend-aasland
pushed a commit
that referenced
this issue
Apr 17, 2024
erlend-aasland
pushed a commit
that referenced
this issue
Apr 17, 2024
…are positional-only (#117939)
Closing. Thanks, @erlend-aasland, @vstinner. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Bug description:
When using the Argument Clinic to implement a function with
METH_METHOD
calling convention, the generated code can cause a crash ifdefining_class
is used without slashing. For example,datetime.now()
inModules/_datetimemodule.c
produces:/*[clinic input] @classmethod datetime.datetime.now + cls: defining_class tz: object = None Timezone object. Returns new datetime object representing current time local to tz. If no tz is specified, uses local timezone. [clinic start generated code]*/ static PyObject * datetime_datetime_now_impl(PyTypeObject *type, ...
No crash if
NUM_KEYWORDS
below is 1 in_datetimemodule.c.h
:CPython versions tested on:
3.13, CPython main branch
Operating systems tested on:
Windows
Linked PRs
defining_class
params are positional-only #117781defining_class
params are positional-only #117939defining_class
parameter at module level #117950The text was updated successfully, but these errors were encountered: