Closed aron-bordin closed 8 years ago
I tested using only ast, and I see that it works with def visit_Expr
instead of def visit_Call
.
So the problem is on my transformer, sorry :confused:
But using only ast, this transformer was not working on python2 and not working on py3; with astor, it works on py2. I'm closing the issue, because it seems to be a problem with my transformer(this is my first usage of ast), but if there is anything that I can help, I'd love to help ;)
Thx
Without thinking too hard about your code and what is going on, you could certainly replace the statement:
def visit_Expr(self, node):
set_precedence(node, node.value)
...
With:
def visit_Expr(self, node):
if hasattr(node, 'value'):
set_precedence(node, node.value)
...
to see if that helps. But if you want to open a PR, you'd need to explain carefully what this is good for, with a good example (and preferably a test case).
Regards, Pat
I received the same error when using visit_Call() then doing astor.to_source(). The issue can be fixed with 'return ast.Expr(value=None)' instead of 'return None'
Hi!
I have the following example:
It works with Python 2.7, but raise the following error on Python3.5
Am I missing something? Is it a bug? If so, please if possible, point me some direction that I'd love to create a PR.
Thank you