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
attrs plugin crashes with order comparison methods #22290
The attrs plugin crashes when processing a class twice.
attrs defaults to order=False for define/frozen, but mypy synthesises ordering methods when the order parameter is omitted from the decorator. Reprocessing then collides with the annotated attribute in the class body.
The repro below is slightly contrived, the real case was mypy processing the same class twice due to circular imports.
Traceback
t.py: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 2.4.0
Traceback (most recent call last):
File ".../bin/mypy", line 12, in <module>
sys.exit(console_entry())
File "mypy/build.py", line 3094, in wrap_contextAssertionError: FuncDef:5(
__lt__
Args(
Var:nil(self)
Var:nil(other))
def [_AT] (self: _AT, other: _AT) -> bool
Block:-1(
PassStmt:-1()))
t.py: note: use --pdb to drop into pdb
To Reproduce
uvx --with attrs mypy --show-traceback t.py
importattrs@attrs.define@attrs.frozenclassC:
__lt__: int
Your Environment
Mypy version used: 2.4.0
Mypy command-line flags: None
Mypy configuration options from mypy.ini (and other config files): None
Activity