|
1 | 1 | """Type checking of attribute access"""
|
2 | 2 |
|
3 |
| -from typing import cast, Callable, List, Optional, TypeVar |
| 3 | +from typing import cast, Callable, List, Optional, TypeVar, Any |
4 | 4 |
|
5 | 5 | from mypy.types import (
|
6 | 6 | Type, Instance, AnyType, TupleType, TypedDictType, CallableType, FunctionLike, TypeVarDef,
|
@@ -624,10 +624,12 @@ def analyze_class_attribute_access(itype: Instance,
|
624 | 624 | return mx.chk.handle_partial_var_type(t, mx.is_lvalue, symnode, mx.context)
|
625 | 625 |
|
626 | 626 | # Find the class where method/variable was defined.
|
627 |
| - if isinstance(node.node, Decorator): |
628 |
| - super_info = node.node.var.info # type: Optional[TypeInfo] |
629 |
| - elif isinstance(node.node, (Var, FuncBase)): |
630 |
| - super_info = node.node.info |
| 627 | + # mypyc hack to workaround mypy misunderstanding multiple inheritance (#3603) |
| 628 | + node_node = node.node # type: Any |
| 629 | + if isinstance(node_node, Decorator): |
| 630 | + super_info = node_node.var.info # type: Optional[TypeInfo] |
| 631 | + elif isinstance(node_node, (Var, FuncBase)): |
| 632 | + super_info = node_node.info |
631 | 633 | else:
|
632 | 634 | super_info = None
|
633 | 635 |
|
|
0 commit comments