Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Objects/typevarobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -2123,11 +2123,6 @@ typealias_new_impl(PyTypeObject *type, PyObject *name, PyObject *value,
return NULL;
}

PyObject *module = caller();
if (module == NULL) {
return NULL;
}

if (qualname == NULL || qualname == Py_None) {
// If qualname was not set directly, we use name instead.
qualname = name;
Expand All @@ -2138,6 +2133,11 @@ typealias_new_impl(PyTypeObject *type, PyObject *name, PyObject *value,
}
}
Copy link
Member

@efimov-mikhail efimov-mikhail Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, it's better to place obtaining of module after qualname related if-block and remove a call of Py_DECREF(module).


PyObject *module = caller();
if (module == NULL) {
return NULL;
}

PyObject *ta = (PyObject *)typealias_alloc(
name, qualname, checked_params, NULL, value, module);
Py_DECREF(module);
Expand Down
Loading