Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue7253] AssertionError Tree is insane with *args and reduce

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Nov 2, 2009, 9:13 AM

Post #1 of 3 (48 views)
Permalink
[issue7253] AssertionError Tree is insane with *args and reduce

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>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 2, 2009, 9:22 AM

Post #2 of 3 (45 views)
Permalink
[issue7253] AssertionError Tree is insane with *args and reduce [In reply to]

Changes by Antoine Pitrou <pitrou[at]free.fr>:


----------
assignee: -> benjamin.peterson
nosy: +benjamin.peterson
priority: -> normal

_______________________________________
Python tracker <report[at]bugs.python.org>
<http://bugs.python.org/issue7253>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 2, 2009, 10:06 AM

Post #3 of 3 (45 views)
Permalink
[issue7253] AssertionError Tree is insane with *args and reduce [In reply to]

Benjamin Peterson <benjamin[at]python.org> added the comment:

Fixed in r76061.

----------
resolution: -> fixed
status: open -> closed

_______________________________________
Python tracker <report[at]bugs.python.org>
<http://bugs.python.org/issue7253>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.