[New-bugs-announce] [issue6899] Base.replace breaks tree

Martin v. Löwis report at bugs.python.org
Sun Sep 13 10:50:41 CEST 2009


New submission from Martin v. Löwis <martin at v.loewis.de>:

In Base.replace, the method checks that self.parent is not None - 
however, it (unfortunately), breaks this very property itself if self is 
new, or self in new.

In particular, some fixers return node from transform if they don't want 
to do anything. In that case, self.parent gets set to None, even though 
new (which is self) is still connected to the tree.

This patch
a) short-cuts the case that self is new
b) arranges to set parent of the new nodes only after clearing parent of 
self

----------
components: 2to3 (2.x to 3.0 conversion tool)
files: python.patch
keywords: patch
messages: 92563
nosy: loewis
severity: normal
status: open
title: Base.replace breaks tree
Added file: http://bugs.python.org/file14883/python.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6899>
_______________________________________


More information about the New-bugs-announce mailing list