-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IndexError in visit_AnnAssign #62
Comments
Hi, Hmm. Let's see if we can figure this out just by looking at the analyzer code. Since it's running the first branch of the It seems that for some reason, To debug further, could you modify your copy of def visit_AnnAssign(self, node): # PEP 526, Python 3.6+
target = sanitize_exprs(node.target)
self.last_value = None
if node.value is not None:
value = sanitize_exprs(node.value)
print(id(node), value, ast.dump(node.value)) # <--- added this print here
self.logger.debug("AnnAssign %s %s, %s:%s" % (get_ast_node_name(target[0]),
get_ast_node_name(value[0]),
self.filename, node.lineno))
self.analyze_binding(target, value)
else: # just a type declaration
self.logger.debug("AnnAssign %s <no value>, %s:%s" % (get_ast_node_name(target[0]),
self.filename, node.lineno))
self.last_value = None
self.visit(target[0])
# TODO: use the type annotation from node.annotation?
# http://greentreesnakes.readthedocs.io/en/latest/nodes.html#AnnAssign |
These the values returned:
|
Thanks! Now I see the problem. Since the code triggering the error is just a debug log call, I think it's safe to change the Could you try that and report back if it works? If so, I'll push a fix. |
It works without the index, thanks |
Thanks for testing! I'll push a fix. |
Hi.
trying to run pyan against my code, it crashes with this error:
Cannot share my code, but if I could do something else to help you in debugging, just let me know
The text was updated successfully, but these errors were encountered: