This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: node.pre_order() does not do preorder traversal
Type: behavior Stage:
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 3.1, Python 3.2, Python 2.7, Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: joe.amenta
Priority: normal Keywords:

Created on 2010-08-08 04:08 by joe.amenta, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg113233 - (view) Author: Joe Amenta (joe.amenta) Date: 2010-08-08 04:08
In Lib/lib2to3/pytree.py, Node.pre_order() calls the post_order() method of its children, instead of pre_order().  As a result, the only difference between the two orderings is that pre_order() yields the original node first, whereas post_order() yields the original node last.  It seems highly unlikely to me that any code would depend on this behavior.

The fix, of course, is trivial: change the call to child.post_order() on line 289 into a call to child.pre_order().
msg113234 - (view) Author: Joe Amenta (joe.amenta) Date: 2010-08-08 04:09
Fixed in r83811.
History
Date User Action Args
2022-04-11 14:57:05adminsetgithub: 53750
2010-08-25 03:43:35benjamin.petersonsetresolution: fixed
2010-08-08 04:09:46joe.amentasetstatus: open -> closed

messages: + msg113234
2010-08-08 04:08:17joe.amentacreate