AttributeError exception in build_unannotated_method_args (#429)

* AttributeError exception in build_unannotated_method_args

* assigning [] to arguments if AttributeError

Co-authored-by: Kacper Szmigiel <szmigielkacper@gmai.com>
This commit is contained in:
Kacper
2020-07-21 14:31:19 +02:00
committed by GitHub
parent 97ec2ee43b
commit 3915aa0639

View File

@@ -311,7 +311,11 @@ def add_new_sym_for_info(info: TypeInfo, *, name: str, sym_type: MypyType) -> No
def build_unannotated_method_args(method_node: FuncDef) -> Tuple[List[Argument], MypyType]: def build_unannotated_method_args(method_node: FuncDef) -> Tuple[List[Argument], MypyType]:
prepared_arguments = [] prepared_arguments = []
for argument in method_node.arguments[1:]: try:
arguments = method_node.arguments[1:]
except AttributeError:
arguments = []
for argument in arguments:
argument.type_annotation = AnyType(TypeOfAny.unannotated) argument.type_annotation = AnyType(TypeOfAny.unannotated)
prepared_arguments.append(argument) prepared_arguments.append(argument)
return_type = AnyType(TypeOfAny.unannotated) return_type = AnyType(TypeOfAny.unannotated)