File tree 2 files changed +35
-1
lines changed
2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -828,7 +828,7 @@ def _add_attrs_magic_attribute(
828
828
ctx .cls ,
829
829
MAGIC_ATTR_NAME ,
830
830
TupleType (attributes_types , fallback = attributes_type ),
831
- fullname = f"{ ctx .cls .fullname } .{ attr_name } " ,
831
+ fullname = f"{ ctx .cls .fullname } .{ MAGIC_ATTR_NAME } " ,
832
832
override_allow_incompatible = True ,
833
833
is_classvar = True ,
834
834
)
Original file line number Diff line number Diff line change @@ -46,3 +46,37 @@ A.__attrs_attrs__.b
46
46
47
47
[out]
48
48
==
49
+
50
+ [case magicAttributeConsistency2-only_when_cache]
51
+ [file c.py]
52
+ import attr
53
+
54
+ @attr.s
55
+ class Entry:
56
+ var: int = attr.ib()
57
+ [builtins fixtures/attr.pyi]
58
+
59
+ [file m.py]
60
+ from typing import Any, ClassVar, Protocol
61
+ from c import Entry
62
+
63
+ class AttrsInstance(Protocol):
64
+ __attrs_attrs__: ClassVar[Any]
65
+
66
+ def func(e: AttrsInstance) -> None: ...
67
+ func(Entry(2))
68
+
69
+ [file m.py.2]
70
+ from typing import Any, ClassVar, Protocol
71
+ from c import Entry
72
+
73
+ class AttrsInstance(Protocol):
74
+ __attrs_attrs__: ClassVar[Any]
75
+
76
+ def func(e: AttrsInstance) -> int:
77
+ return 2 # Change return type to force reanalysis
78
+
79
+ func(Entry(2))
80
+
81
+ [out]
82
+ ==
You can’t perform that action at this time.
0 commit comments