Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
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 10 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,
}
}

@efimov-mikhail efimov-mikhail Oct 16, 2025

Copy link
Copy Markdown
Member

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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.