[issue2170] rewrite of minidom.Node.normalize

Malte Helmert report at bugs.python.org
Tue Mar 17 17:05:51 CET 2009


Malte Helmert <helmert at informatik.uni-freiburg.de> added the comment:

I eyeballed the new patch and wonder if the case where text nodes are
collapsed is handled correctly. Assume that self.childNodes contains
nodes [A, B, C], where A and B are non-empty text nodes and C is a
non-text node.

The algorithm would collapse A and B into A and then unlink B, and I
think C.previousSibling would still reference the unlinked B, rather
than the correct A. Am I missing something?

If this is indeed a bug in the proposed patch, I suggest adding an
additional test for this case.

The bug itself should not be too hard to fix; the "elif" case would need
the same

    if child.nextSibling:
        child.nextSibling.previousSibling = child.previousSibling

assignment as the "if" case.

----------

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


More information about the Python-bugs-list mailing list