[Python-checkins] r60998 - in python/branches/release25-maint: Lib/test/test_minidom.py Lib/xml/dom/minidom.py Misc/ACKS Misc/NEWS

andrew.kuchling python-checkins at python.org
Sat Feb 23 18:21:44 CET 2008


Author: andrew.kuchling
Date: Sat Feb 23 18:21:44 2008
New Revision: 60998

Modified:
   python/branches/release25-maint/Lib/test/test_minidom.py
   python/branches/release25-maint/Lib/xml/dom/minidom.py
   python/branches/release25-maint/Misc/ACKS
   python/branches/release25-maint/Misc/NEWS
Log:
#1433694: minidom's .normalize() failed to set .nextSibling for last element.
Fix by Malte Helmert

Modified: python/branches/release25-maint/Lib/test/test_minidom.py
==============================================================================
--- python/branches/release25-maint/Lib/test/test_minidom.py	(original)
+++ python/branches/release25-maint/Lib/test/test_minidom.py	Sat Feb 23 18:21:44 2008
@@ -806,6 +806,14 @@
             "testNormalize -- single empty node removed")
     doc.unlink()
 
+def testBug1433694():
+    doc = parseString("<o><i/>t</o>")
+    node = doc.documentElement
+    node.childNodes[1].nodeValue = ""
+    node.normalize()
+    confirm(node.childNodes[-1].nextSibling == None,
+            "Final child's .nextSibling should be None")
+
 def testSiblings():
     doc = parseString("<doc><?pi?>text?<elm/></doc>")
     root = doc.documentElement

Modified: python/branches/release25-maint/Lib/xml/dom/minidom.py
==============================================================================
--- python/branches/release25-maint/Lib/xml/dom/minidom.py	(original)
+++ python/branches/release25-maint/Lib/xml/dom/minidom.py	Sat Feb 23 18:21:44 2008
@@ -203,6 +203,8 @@
                 L.append(child)
                 if child.nodeType == Node.ELEMENT_NODE:
                     child.normalize()
+        if L:
+            L[-1].nextSibling = None
         self.childNodes[:] = L
 
     def cloneNode(self, deep):

Modified: python/branches/release25-maint/Misc/ACKS
==============================================================================
--- python/branches/release25-maint/Misc/ACKS	(original)
+++ python/branches/release25-maint/Misc/ACKS	Sat Feb 23 18:21:44 2008
@@ -266,6 +266,7 @@
 Rycharde Hawkes
 Jochen Hayek
 Thomas Heller
+Malte Helmert
 Lance Finn Helsten
 Jonathan Hendry
 James Henstridge

Modified: python/branches/release25-maint/Misc/NEWS
==============================================================================
--- python/branches/release25-maint/Misc/NEWS	(original)
+++ python/branches/release25-maint/Misc/NEWS	Sat Feb 23 18:21:44 2008
@@ -15,6 +15,10 @@
 Library
 -------
 
+- Bug #1433694: minidom's .normalize() failed to set .nextSibling for
+  last child element.
+
+
 Extension Modules
 -----------------
 


More information about the Python-checkins mailing list