Skip to content

ga_getitem can fail if Py_GenericAlias returns NULL #121660

Closed
@sobolevn

Description

@sobolevn

Bug report

This code is problematic:

PyObject *res = Py_GenericAlias(alias->origin, newargs);
((gaobject *)res)->starred = alias->starred;
Py_DECREF(newargs);
return res;

Why? Py_GenericAlias can return NULL in different cases:

return NULL;
}
if (!setup_ga(alias, origin, args)) {
Py_DECREF(alias);
return NULL;

So, we need to check for NULL.

Linked PRs

Metadata

Metadata

Assignees

Labels

interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions