8000 gh-119011: Return an empty tuple on type_get_type_params as special c… · mdkcore0/cpython@65ae07b · GitHub
[go: up one dir, main page]

Skip to content

Commit 65ae07b

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

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed
Lines changed: 2 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
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)
0