typeshed
typeshed copied to clipboard
functools.wraps returns function with incorrect signature
Applying functools.wraps
to a function returns the function unchanged, but it should instead copy the signature of the wrapped function:
def func(x: bool) -> str:
return str(x)
@wraps(func)
def test(*args, **kwargs):
return func(*args, **kwargs)
print(inspect.signature(test)) # (x: bool) -> str
reveal_type(test) # Revealed type is "def (*args: Any, **kwargs: Any) -> Any"