Skip to content

Commit 92050e8

Browse files
gh-101967: add a missing error check (GH-101968)
(cherry picked from commit 89413bb) Co-authored-by: Eclips4 <[email protected]>
1 parent 3c1b495 commit 92050e8

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix possible segfault in ``positional_only_passed_as_keyword`` function, when new list created.

Python/ceval.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4718,7 +4718,9 @@ positional_only_passed_as_keyword(PyThreadState *tstate, PyCodeObject *co,
47184718
{
47194719
int posonly_conflicts = 0;
47204720
PyObject* posonly_names = PyList_New(0);
4721-
4721+
if (posonly_names == NULL) {
4722+
goto fail;
4723+
}
47224724
for(int k=0; k < co->co_posonlyargcount; k++){
47234725
PyObject* posonly_name = PyTuple_GET_ITEM(co->co_varnames, k);
47244726

0 commit comments

Comments
 (0)