AttributeError exception in copy_method_to_another_class (#531)

* Fix for method_node having no arguments

* Trim whitespace
This commit is contained in:
javulticat
2020-11-17 02:24:59 -05:00
committed by GitHub
parent 19d695b1da
commit 4cb13a6ac5

View File

@@ -361,8 +361,13 @@ def copy_method_to_another_class(
if isinstance(bound_return_type, PlaceholderNode):
return
try:
original_arguments = method_node.arguments[1:]
except AttributeError:
original_arguments = []
for arg_name, arg_type, original_argument in zip(
method_type.arg_names[1:], method_type.arg_types[1:], method_node.arguments[1:]
method_type.arg_names[1:], method_type.arg_types[1:], original_arguments
):
bound_arg_type = semanal_api.anal_type(arg_type, allow_placeholder=True)
if bound_arg_type is None and not semanal_api.final_iteration: