Closed
Description
While all of the pytest tests pass, the example from the readme:
from ast_tools.passes import begin_rewrite, loop_unroll, end_rewrite
@end_rewrite()
@loop_unroll()
@begin_rewrite()
def foo():
for i in ast_tools.macros.unroll(range(8)):
print(i)
Fails with the error:
Traceback (most recent call last):
File "tests/test_readme.py", line 5, in <module>
@begin_rewrite()
File "/ast_tools/ast_tools/passes/base.py", line 23, in __call__
return self.rewrite(*args)
File "/ast_tools/ast_tools/passes/loop_unroll.py", line 15, in rewrite
return unroll_for_loops(tree, env), env, metadata
File "/ast_tools/ast_tools/transformers/loop_unroller.py", line 49, in unroll_for_loops
new_body = tree.body.visit(visitor)
AttributeError: 'list' object has no attribute 'visit'
I actually can't get any code that uses either the @begin_rewrite() and @end_rewrite() or the @apply_ast_passes to work.
This is on Python3.7 in a completely new virtualenv.
Metadata
Metadata
Assignees
Labels
No labels