-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Closed
Labels
3.12only security fixesonly security fixes3.13bugs and security fixesbugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Repro:
>>> from reprlib import recursive_repr
>>>
>>> class My:
... @recursive_repr()
... def __repr__[T](self, converter: T | None = None): ...
...
>>> My().__repr__.__type_params__
()This happens because recursive_repr does not use @wraps, but reinvents it:
Lines 26 to 33 in f2eaa92
| # Can't use functools.wraps() here because of bootstrap issues | |
| wrapper.__module__ = getattr(user_function, '__module__') | |
| wrapper.__doc__ = getattr(user_function, '__doc__') | |
| wrapper.__name__ = getattr(user_function, '__name__') | |
| wrapper.__qualname__ = getattr(user_function, '__qualname__') | |
| wrapper.__annotations__ = getattr(user_function, '__annotations__', {}) | |
| wrapper.__wrapped__ = user_function | |
| return wrapper |
And __type_params__ was added in #104600
Linked PRs
Metadata
Metadata
Assignees
Labels
3.12only security fixesonly security fixes3.13bugs and security fixesbugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error