summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2008-02-23 17:21:44 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2008-02-23 17:21:44 (GMT)
commit05a19a507d8ef57f24d713dd29dcc79494705d18 (patch)
tree538c4067928888053593b3469b0d7add4e8a16f1
parentbe0adfcfa8327b68fed6158fe423656289a870cc (diff)
downloadcpython-05a19a507d8ef57f24d713dd29dcc79494705d18.zip
cpython-05a19a507d8ef57f24d713dd29dcc79494705d18.tar.gz
cpython-05a19a507d8ef57f24d713dd29dcc79494705d18.tar.bz2
#1433694: minidom's .normalize() failed to set .nextSibling for last element.
Fix by Malte Helmert
-rw-r--r--Lib/test/test_minidom.py8
-rw-r--r--Lib/xml/dom/minidom.py2
-rw-r--r--Misc/ACKS1
-rw-r--r--Misc/NEWS4
4 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py
index a6d309f..4ace1eb 100644
--- a/Lib/test/test_minidom.py
+++ b/Lib/test/test_minidom.py
@@ -806,6 +806,14 @@ def testNormalize():
"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
diff --git a/Lib/xml/dom/minidom.py b/Lib/xml/dom/minidom.py
index 3a35781..b94a4c7 100644
--- a/Lib/xml/dom/minidom.py
+++ b/Lib/xml/dom/minidom.py
@@ -203,6 +203,8 @@ class Node(xml.dom.Node):
L.append(child)
if child.nodeType == Node.ELEMENT_NODE:
child.normalize()
+ if L:
+ L[-1].nextSibling = None
self.childNodes[:] = L
def cloneNode(self, deep):
diff --git a/Misc/ACKS b/Misc/ACKS
index 8cb117f..c3a0942 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -266,6 +266,7 @@ Shane Hathaway
Rycharde Hawkes
Jochen Hayek
Thomas Heller
+Malte Helmert
Lance Finn Helsten
Jonathan Hendry
James Henstridge
diff --git a/Misc/NEWS b/Misc/NEWS
index aec1f2f..4d40719 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -15,6 +15,10 @@ Core and builtins
Library
-------
+- Bug #1433694: minidom's .normalize() failed to set .nextSibling for
+ last child element.
+
+
Extension Modules
-----------------