Closed
Description
Bug report
Bug description:
from functools import update_wrapper
def my_type(*args): pass
t = update_wrapper(my_type, type)
This works on Python ≤ 3.11, and I think this is expected because the docs for update_wrapper
claim that it may be used with callables other than functions.
However, with 3.12, I get
TypeError: __type_params__ must be set to a tuple
(Similarly for functools.wraps
.)
The problem is that update_wrapper includes __type_params__
by default (which is undocumented, see related issue) and type.__type_params__
is a descriptor.
CPython versions tested on:
3.12
Operating systems tested on:
Linux
Linked PRs
- gh-119011:
type.__type_params__
now return an empty tuple #119296 - gh-119011: Return an empty tuple on type_get_type_params as special case for PyType_Type #119313
- [3.13] gh-119011:
type.__type_params__
now return an empty tuple (GH-119296) #119678 - [3.12] gh-119011:
type.__type_params__
now return an empty tuple (GH-119296) #119681