mirror of
https://github.com/python/cpython.git
synced 2025-10-17 20:28:43 +00:00
gh-124498: Fix TypeAliasType
not to be generic, when type_params=()
(#124499)
This commit is contained in:
parent
cf2418076d
commit
abe5f799e6
3 changed files with 25 additions and 1 deletions
|
@ -1915,7 +1915,16 @@ typealias_alloc(PyObject *name, PyObject *type_params, PyObject *compute_value,
|
|||
return NULL;
|
||||
}
|
||||
ta->name = Py_NewRef(name);
|
||||
ta->type_params = Py_IsNone(type_params) ? NULL : Py_XNewRef(type_params);
|
||||
if (
|
||||
type_params == NULL
|
||||
|| Py_IsNone(type_params)
|
||||
|| (PyTuple_Check(type_params) && PyTuple_GET_SIZE(type_params) == 0)
|
||||
) {
|
||||
ta->type_params = NULL;
|
||||
}
|
||||
else {
|
||||
ta->type_params = Py_NewRef(type_params);
|
||||
}
|
||||
ta->compute_value = Py_XNewRef(compute_value);
|
||||
ta->value = Py_XNewRef(value);
|
||||
ta->module = Py_XNewRef(module);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue