Skip to content

Commit a493713

Browse files
committed
pythongh-119011: Return an empty tuple on type_get_type_params as special case for PyType_Type
1 parent c4722cd commit a493713

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This fixes an issue with ``functools.update_wrapper`` where it was not
2+
returning a tuple for ``__type_params__`` as expected.

Objects/typeobject.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1743,7 +1743,7 @@ static PyObject *
17431743
type_get_type_params(PyTypeObject *type, void *context)
17441744
{
17451745
PyObject *params;
1746-
if (PyDict_GetItemRef(lookup_tp_dict(type), &_Py_ID(__type_params__), &params) == 0) {
1746+
if (type == &PyType_Type || PyDict_GetItemRef(lookup_tp_dict(type), &_Py_ID(__type_params__), &params) == 0) {
17471747
return PyTuple_New(0);
17481748
}
17491749
return params;

0 commit comments

Comments
 (0)