8000 bpo-37207: Use vertorcall for list() by encukou · Pull Request #18928 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-37207: Use vertorcall for list() 8000 #18928

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

Merged
merged 7 commits into from
Mar 30, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use Py_ssize_t for argument count
  • Loading branch information
encukou committed Mar 11, 2020
commit 9d53274b742f18290f6741d56cb95dfb6ea5ecd9
4 changes: 2 additions & 2 deletions Objects/listobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -2725,9 +2725,9 @@ list_vectorcall(PyObject *type, PyObject * const*args,
PyErr_Format(PyExc_TypeError, "list() takes no keyword arguments");
return NULL;
}
size_t nargs = PyVectorcall_NARGS(nargsf);
Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
if (nargs > 1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can replace it into

if (!_PyArg_CheckPositional("list", nargs, 0, 1)) {
    return NULL;
}

PyErr_Format(PyExc_TypeError, "list() expected at most 1 argument, got %zu", nargs);
PyErr_Format(PyExc_TypeError, "list() expected at most 1 argument, got %zd", nargs);
return NULL;
}

Expand Down
0