mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
gh-98852: Fix subscription of type aliases (GH-98920)
Fix subscription of type aliases containing bare generic types or types like TypeVar: for example tuple[A, T][int] and tuple[TypeVar, T][int], where A is a generic type, and T is a type variable.
This commit is contained in:
parent
f5afb7f233
commit
0e15c31c7e
4 changed files with 43 additions and 0 deletions
|
|
@ -458,6 +458,13 @@ _Py_subs_parameters(PyObject *self, PyObject *args, PyObject *parameters, PyObje
|
|||
}
|
||||
for (Py_ssize_t iarg = 0, jarg = 0; iarg < nargs; iarg++) {
|
||||
PyObject *arg = PyTuple_GET_ITEM(args, iarg);
|
||||
if (PyType_Check(arg)) {
|
||||
Py_INCREF(arg);
|
||||
PyTuple_SET_ITEM(newargs, jarg, arg);
|
||||
jarg++;
|
||||
continue;
|
||||
}
|
||||
|
||||
int unpack = _is_unpacked_typevartuple(arg);
|
||||
if (unpack < 0) {
|
||||
Py_DECREF(newargs);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue