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
I would expect the decorator applies to the body not to the name itself. For that I would expect you would still need # type: ignore[no-redef] but it looks like you also have the decorator on the enclosing function so I would expect you not to need the type comment.
For kicks do you want to test if the name test is the only issue or does it not descend into enclosed functions? Actually looking at #10001 you are suggesting it is type checking the enclosed function.
I would expect you would need
@no_type_checkdefwrapper(...):
# lines don't need type: ignore@no_type_checkdefwrapped(...): # type: ignore[no-redef]# lines don't need type: ignore
If you indeed need the # type: ignore[no-redef] on the enclosed function I would suggest that's a bug since it should be covered by the @no_type_check decorator on wrapper, but I'm not sure mypy should default to not type checking recursively. If you are incrementally adding types you may add typing to the enclosed function and it might be better to be explicit and add the @no_type_check decorator you were attempting to add.
I would agree that @no_type_check should suppress all errors within the body of a function, including in nested functions and redefinitions. I haven't checked but it might be a fairly easy fix.
Bug Report
Mypy ignores no_type_check, specifically for nested function redefinitions.
To Reproduce
@typing.no_type_check
.I've tried to deal with it in many ways, including opening a different bug, to no avail.
Your Environment
mypy.ini
(and other config files): NopeThe text was updated successfully, but these errors were encountered: