berkerpeksag / astor

Python AST read/write
https://pypi.org/project/astor/
BSD 3-Clause "New" or "Revised" License
810 stars 102 forks source link

test_try_expect fails with Python 3.5 #48

Closed felixonmars closed 7 years ago

felixonmars commented 8 years ago

Not sure if it's introduced by Python 3.5, though. Hope it helps:

.....E.
======================================================================
ERROR: test_try_expect (tests.test_codegen.CodegenTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/python-astor/src/astor/tests/test_codegen.py", line 47, in test_try_expect
    self.assertAstSourceEqual(source)
  File "/build/python-astor/src/astor/tests/test_codegen.py", line 24, in assertAstSourceEqual
    self.assertEqual(astor.to_source(ast.parse(source)), source)
  File "/build/python-astor/src/astor/astor/codegen.py", line 40, in to_source
    generator.visit(node)
  File "/build/python-astor/src/astor/astor/misc.py", line 161, in visit
    return visitor(node)
  File "/build/python-astor/src/astor/astor/codegen.py", line 493, in visit_Module
    self.visit(stmt)
  File "/build/python-astor/src/astor/astor/misc.py", line 161, in visit
    return visitor(node)
  File "/build/python-astor/src/astor/astor/codegen.py", line 288, in visit_Try
    self.visit(handler)
  File "/build/python-astor/src/astor/astor/misc.py", line 161, in visit
    return visitor(node)
  File "/build/python-astor/src/astor/astor/codegen.py", line 300, in visit_ExceptHandler
    self.body(node.body)
  File "/build/python-astor/src/astor/astor/codegen.py", line 99, in body
    self.visit(stmt)
  File "/build/python-astor/src/astor/astor/misc.py", line 161, in visit
    return visitor(node)
  File "/build/python-astor/src/astor/astor/codegen.py", line 179, in visit_Expr
    self.generic_visit(node)
  File "/usr/lib/python3.5/ast.py", line 255, in generic_visit
    self.visit(value)
  File "/build/python-astor/src/astor/astor/misc.py", line 161, in visit
    return visitor(node)
  File "/build/python-astor/src/astor/astor/codegen.py", line 366, in visit_Call
    self.conditional_write(write_comma, '*', node.starargs)
AttributeError: 'Call' object has no attribute 'starargs'

----------------------------------------------------------------------
Ran 7 tests in 0.012s

FAILED (errors=1)
refi64 commented 7 years ago

Has this been fixed in master? The test passes for me.

berkerpeksag commented 7 years ago

I don't think we did anything in master to fix this. Perhaps something had changed in Python? It would be nice to do some detective work :)

felixonmars commented 7 years ago

The same error is still present here for Python 3.6 :(

pmaupin commented 7 years ago

I thought I fixed this in trunk in May 2015 974d7a2d6baa607d774601c01e02e6489e9ca54a

Then I cleaned it up some more after that.

There certainly shouldn't be any direct reference to node.starargs

Probably past time for a release if we haven't released such a fix yet.

Regards, Pat

felixonmars commented 7 years ago

Oops, sorry. The test was invalid and it actually passes in Python 3.6. Thanks a lot! Hope there will be a release soon.

berkerpeksag commented 7 years ago

Yay! Closing this then.