-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrong
Description
Bug Report
mypy sometimes erroneously emits a "Self argument missing" error on function definitions inside class definitons. See the example below.
If the function has no paramters, the error is "Method must have at least one argument.". Again, it does not matter what the decorator does to the function.
To Reproduce
import typing
def apply_on_answer[T](f: typing.Callable[[int], T], /) -> T:
return f(42)
class C:
@apply_on_answer
def x(answer: int) -> int:
return answer
assert type(C.x) is int
assert C.x == 42
Expected Behavior
mypy should emit no errors.
Actual Behavior
mypy emits the following error:
a.py:8: error: Self argument missing for a non-static method (or an invalid type for self) [misc]
Your Environment
- Mypy version used: cb3bddd
- Mypy command-line flags:
--strict
- Mypy configuration options from
mypy.ini
(and other config files): `` - Python version used: 3.13.5
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong