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
Given a member function decorated with @property, a synonym created by assignment is not recognized as a property. Instead it is considered a function.
To Reproduce
Consider the following python script:
Running it prints 42 (and not <bound method Class.my_function of <__main__.Class object at 0x7f60f14d8460>>).
Expected Behavior
mypy should report Success: no issues found in 1 source file
Actual Behavior
mypy reports:
mjb.py:9: error: Incompatible types in assignment (expression has type "Callable[[], int]", variable has type "int") [assignment]
Found 1 error in 1 file (checked 1 source file)
Workround
If the penultimate line is changed to i: int = c.my_function mypy accepts it with no errors.
Your Environment
Mypy version used: 1.2.0
Mypy command-line flags: None
Mypy configuration options from mypy.ini (and other config files): None
Python version used: 3.10.5
Motivating use case
One obvious answer to this is "don't create such damn-fool aliases in the first place". However we ran into the underlying problem because the git module does exactly this, and we happened to use Repo.refs rather than Repo.references. As noted in the workround, changing to Repo.references worked.
The text was updated successfully, but these errors were encountered:
Bug Report
Given a member function decorated with
@property
, a synonym created by assignment is not recognized as a property. Instead it is considered a function.To Reproduce
Consider the following python script:
Running it prints 42 (and not
<bound method Class.my_function of <__main__.Class object at 0x7f60f14d8460>>
).Expected Behavior
mypy should report
Success: no issues found in 1 source file
Actual Behavior
mypy reports:
Workround
If the penultimate line is changed to
i: int = c.my_function
mypy accepts it with no errors.Your Environment
mypy.ini
(and other config files): NoneMotivating use case
One obvious answer to this is "don't create such damn-fool aliases in the first place". However we ran into the underlying problem because the
git
module does exactly this, and we happened to useRepo.refs
rather thanRepo.references
. As noted in the workround, changing toRepo.references
worked.The text was updated successfully, but these errors were encountered: