[Python-checkins] gh-101967: add a missing error check (GH-101968)

miss-islington webhook-mailer at python.org
Fri Feb 17 20:13:48 EST 2023


https://github.com/python/cpython/commit/92050e87677548e9283f32c18c984f1cf1d4fc76
commit: 92050e87677548e9283f32c18c984f1cf1d4fc76
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2023-02-17T17:13:33-08:00
summary:

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

(cherry picked from commit 89413bbccb9261b72190e275eefe4b0d49671477)

Co-authored-by: Eclips4 <80244920+Eclips4 at users.noreply.github.com>

files:
A Misc/NEWS.d/next/Core and Builtins/2023-02-16-23-19-01.gh-issue-101967.Kqr1dz.rst
M Python/ceval.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-02-16-23-19-01.gh-issue-101967.Kqr1dz.rst b/Misc/NEWS.d/next/Core and Builtins/2023-02-16-23-19-01.gh-issue-101967.Kqr1dz.rst
new file mode 100644
index 000000000000..6e681f910f53
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2023-02-16-23-19-01.gh-issue-101967.Kqr1dz.rst	
@@ -0,0 +1 @@
+Fix possible segfault in ``positional_only_passed_as_keyword`` function, when new list created.
diff --git a/Python/ceval.c b/Python/ceval.c
index 9719177e19ba..9f4ef6be0e1f 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -4718,7 +4718,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_varnames, k);
 



More information about the Python-checkins mailing list