-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mypy v1.10.0 errors out when functools wraps a method #17166
Comments
almost certainly due to #16942 |
I also hit this in a few places. Here's the relevant upstream bug python/typeshed#10653 Workaround I used: from typing import TYPE_CHECKING
class Bar:
def f(self):
pass
if not TYPE_CHECKING:
f = wraps(Foo.f)(f) |
I've also run into this. My workaround was to use from functools import update_wrapper
class Foo:
def f(self):
pass
class Bar:
def f(self):
pass
update_wrapper(f, Foo.f)
bar = Bar()
bar.f() |
We hit this too. I guess this is the same problem, but it's not our only usage of "wraps", so I'm not really clear why other uses seem to be OK. FWIW my workaround is to include an own-brew replacement for "wraps", based on the above hints :
|
Bug Report
mypy
v1.10.0 gives the following error, while it was working with v1.9.0:To Reproduce
Expected Behavior
There should be no error.
The text was updated successfully, but these errors were encountered: