gh-101967: add a missing error check (#101968)

This commit is contained in:
Eclips4 2023-02-18 03:52:23 +03:00 committed by GitHub
parent 7f1c721756
commit 89413bbccb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -0,0 +1 @@
Fix possible segfault in ``positional_only_passed_as_keyword`` function, when new list created.

View file

@ -1255,7 +1255,9 @@ positional_only_passed_as_keyword(PyThreadState *tstate, PyCodeObject *co,
{
int posonly_conflicts = 0;
PyObject* posonly_names = PyList_New(0);
if (posonly_names == NULL) {
goto fail;
}
for(int k=0; k < co->co_posonlyargcount; k++){
PyObject* posonly_name = PyTuple_GET_ITEM(co->co_localsplusnames, k);