gh-101967: add a missing error check (GH-101968)
(cherry picked from commit
89413bbccb9261b72190e275eefe4b0d49671477)
Co-authored-by: Eclips4 <80244920+Eclips4@users.noreply.github.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
--- /dev/null
+Fix possible segfault in ``positional_only_passed_as_keyword`` function, when new list created.
{
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);