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
(A clear and concise description of what the bug is.)
I receive the following error from mypy:
api/serializers.py:10: error: Incompatible types in assignment (expression has type "CharField", base class "Field" defined the type as "Callable[..., Any] | str | None") [assignment]
If I change the name of the attribute source to anything else, the error disappears. I think the attribute and parameter are getting mixed up. The error refers to the attribute assignment but reports the type Callable[..., Any] | str | None" which is correct for the parameter.
To Reproduce
I created a project to display this behavior.
# Ideally, a small sample program that demonstrates the problem.# Or even better, a reproducible playground link https://mypy-play.net/ (use the "Gist" button)
Expected Behavior
I don't think I should receive and error.
Actual Behavior
I get an error.
Your Environment
Ubuntu linux, python 3.10.2
Mypy version used: 1.10.0
Mypy command-line flags: .
Mypy configuration options from mypy.ini (and other config files):
Bug Report
(A clear and concise description of what the bug is.)
I receive the following error from mypy:
api/serializers.py:10: error: Incompatible types in assignment (expression has type "CharField", base class "Field" defined the type as "Callable[..., Any] | str | None") [assignment]
The line in question is:
If I change the name of the attribute
source
to anything else, the error disappears. I think the attribute and parameter are getting mixed up. The error refers to the attribute assignment but reports the typeCallable[..., Any] | str | None"
which is correct for the parameter.To Reproduce
I created a project to display this behavior.
https://github.com/btimby/mypy-django-issue
Expected Behavior
I don't think I should receive and error.
Actual Behavior
I get an error.
Your Environment
Ubuntu linux, python 3.10.2
.
mypy.ini
(and other config files):The text was updated successfully, but these errors were encountered: