You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Mypy v1.10.0 errors out when functools wraps a method #17166
I've also run into this. My workaround was to use update_wrapper() (for which wraps() is a convenience wrapper) instead. This is, understandably, completely invisible to Mypy.
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 :
# Use custom version of "wraps", to workaround MyPy v1.10 problem
# See : https://github.com/python/mypy/issues/17166
# TODO: remove when MyPy fixed
def wraps(x):
def _inner(f):
return update_wrapper(f, x)
return _inner
Activity
AlexWaygood commentedon Apr 24, 2024
almost certainly due to #16942
Hnasar commentedon Apr 24, 2024
I also hit this in a few places. Here's the relevant upstream bug python/typeshed#10653
Workaround I used:
broken-pen commentedon Jun 11, 2024
I've also run into this. My workaround was to use
update_wrapper()(for whichwraps()is a convenience wrapper) instead. This is, understandably, completely invisible to Mypy.pp-mo commentedon Jul 23, 2024
We hit this too.
See: SciTools/iris#6033
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 :
Circumvent Mypy bug around `functools.wraps()`.
davidbrochart commentedon Mar 2, 2026
This doesn't seem to be an issue anymore.