[New-bugs-announce] [issue7253] AssertionError Tree is insane with *args and reduce
Jason R. Coombs
report at bugs.python.org
Mon Nov 2 18:13:47 CET 2009
New submission from Jason R. Coombs <jaraco at jaraco.com>:
Create a file with a single line of code:
def x(arg): return reduce(sum, [])
On Python 3.1.1 (I used Windows 64-bit), run 2to3 on it returns the
following error:
PS C:\Users\jaraco\projects\jaraco.util\jaraco\util>
C:\python\Tools\Scripts\2to3.py .\functools.py
RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
RefactoringTool: Skipping implicit fixer: set_literal
RefactoringTool: Skipping implicit fixer: ws_comma
Traceback (most recent call last):
File "C:\python\Tools\Scripts\2to3.py", line 6, in <module>
sys.exit(main("lib2to3.fixes"))
File "C:\Python\lib\lib2to3\main.py", line 159, in main
options.processes)
File "C:\Python\lib\lib2to3\refactor.py", line 616, in refactor
items, write, doctests_only)
File "C:\Python\lib\lib2to3\refactor.py", line 276, in refactor
self.refactor_file(dir_or_file, write, doctests_only)
File "C:\Python\lib\lib2to3\refactor.py", line 656, in refactor_file
*args, **kwargs)
File "C:\Python\lib\lib2to3\refactor.py", line 328, in refactor_file
tree = self.refactor_string(input, filename)
File "C:\Python\lib\lib2to3\refactor.py", line 358, in refactor_string
self.refactor_tree(tree, name)
File "C:\Python\lib\lib2to3\refactor.py", line 392, in refactor_tree
self.traverse_by(self.post_order_heads, tree.post_order())
File "C:\Python\lib\lib2to3\refactor.py", line 416, in traverse_by
new = fixer.transform(node, results)
File "C:\Python\lib\lib2to3\fixes\fix_reduce.py", line 33, in transform
touch_import('functools', 'reduce', node)
File "C:\Python\lib\lib2to3\fixer_util.py", line 289, in touch_import
root = find_root(node)
File "C:\Python\lib\lib2to3\fixer_util.py", line 265, in find_root
assert node.parent, "Tree is insane! root found before "\
AssertionError: Tree is insane! root found before file_input node was found.
2to3 on Python 2.6.4 does not exhibit the same error.
Remove 'arg' or the call to reduce and the problem is not exhibited.
----------
components: 2to3 (2.x to 3.0 conversion tool)
messages: 94835
nosy: jaraco
severity: normal
status: open
title: AssertionError Tree is insane with *args and reduce
versions: Python 3.1
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7253>
_______________________________________
More information about the New-bugs-announce
mailing list