-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
$ mypy --version
mypy 1.7.1 (compiled: yes)
$ venv/bin/pip list|grep attrs
attrs 23.1.0
$ cat a.py
import attrs
@attrs.define
class A:
_x: int = attrs.field(alias="_x")
a = A(_x=1)
a = A(x=1)
$ venv/bin/python a.py
Traceback (most recent call last):
File "/home/uken/src/mypy-attrs-alias.bug/a.py", line 10, in <module>
a = A(x=1)
^^^^^^
TypeError: A.__init__() got an unexpected keyword argument 'x'
$ mypy --python-executable=venv/bin/python a.py
a.py:9: error: Unexpected keyword argument "_x" for "A" [call-arg]
Found 1 error in 1 file (checked 1 source file)
See: https://www.attrs.org/en/stable/init.html#private-attributes-and-aliases