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

Argument Clinic: vararg + kw-only crash #110864

Closed
sobolevn opened this issue Oct 14, 2023 · 1 comment
Closed

Argument Clinic: vararg + kw-only crash #110864

sobolevn opened this issue Oct 14, 2023 · 1 comment
Assignees
Labels
topic-argument-clinic type-bug An unexpected behavior, bug, or error

Comments

@sobolevn
Copy link
Member

sobolevn commented Oct 14, 2023

Bug report

Originally found in #110782 by @mxschmitt and @JelleZijlstra

This is the reproducer:

/*[clinic input]
null_or_tuple_for_varargs

    name: object
    *constraints: object
    covariant: bool = False

[clinic start generated code]*/

static PyObject *
null_or_tuple_for_varargs_impl(PyObject *module, PyObject *name,
                               PyObject *constraints, int covariant)
/*[clinic end generated code: output=a785b35421358983 input=017dc120cb6e651b]*/
{
    assert(name != NULL);
    assert(constraints != NULL);
    assert(covariant == 0 || covariant == 1);
    Py_RETURN_NONE;
}

When called with name=..., it crashes:

>>> import _testclinic
>>> _testclinic.null_or_tuple_for_varargs('a')

>>> _testclinic.null_or_tuple_for_varargs(name='a')
Assertion failed: (constraints != NULL), function null_or_tuple_for_varargs_impl, file _testclinic.c, line 1148.
[1]    30808 abort      ./python.exe

I have a PR ready with the fix.
CC @erlend-aasland as AC maintainer.

Linked PRs

@hugovk
Copy link
Member

hugovk commented Dec 11, 2023

@sobolevn Ready to close this issue?

aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-argument-clinic type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants