[Python-checkins] bpo-33274: Compliance with DOM L1: return removed attribute (#7465)
Fred Drake
webhook-mailer at python.org
Thu Jun 7 00:42:46 EDT 2018
https://github.com/python/cpython/commit/5bfa058e65897567889354d7eb34af2b93a20f18
commit: 5bfa058e65897567889354d7eb34af2b93a20f18
branch: master
author: arikrupnik <ari at 30pins.com>
committer: Fred Drake <fred at fdrake.net>
date: 2018-06-07T00:42:38-04:00
summary:
bpo-33274: Compliance with DOM L1: return removed attribute (#7465)
* bpo-33274: Compliance with DOM L1: return removed attribute
* Update 2018-06-06-22-01-33.bpo-33274.teYqv8.rst
files:
A Misc/NEWS.d/next/Library/2018-06-06-22-01-33.bpo-33274.teYqv8.rst
M Lib/test/test_minidom.py
M Lib/xml/dom/minidom.py
diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py
index a2cc8828461d..e91cdba1eb2e 100644
--- a/Lib/test/test_minidom.py
+++ b/Lib/test/test_minidom.py
@@ -325,7 +325,7 @@ def testRemoveAttributeNode(self):
node = child.getAttributeNode("spam")
self.assertRaises(xml.dom.NotFoundErr, child.removeAttributeNode,
None)
- child.removeAttributeNode(node)
+ self.assertIs(node, child.removeAttributeNode(node))
self.confirm(len(child.attributes) == 0
and child.getAttributeNode("spam") is None)
dom2 = Document()
diff --git a/Lib/xml/dom/minidom.py b/Lib/xml/dom/minidom.py
index a5d813f932ac..e44e04a069ec 100644
--- a/Lib/xml/dom/minidom.py
+++ b/Lib/xml/dom/minidom.py
@@ -823,6 +823,7 @@ def removeAttributeNode(self, node):
# Restore this since the node is still useful and otherwise
# unlinked
node.ownerDocument = self.ownerDocument
+ return node
removeAttributeNodeNS = removeAttributeNode
diff --git a/Misc/NEWS.d/next/Library/2018-06-06-22-01-33.bpo-33274.teYqv8.rst b/Misc/NEWS.d/next/Library/2018-06-06-22-01-33.bpo-33274.teYqv8.rst
new file mode 100644
index 000000000000..420652bddf6e
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2018-06-06-22-01-33.bpo-33274.teYqv8.rst
@@ -0,0 +1,3 @@
+W3C DOM Level 1 specifies return value of Element.removeAttributeNode() as
+"The Attr node that was removed." xml.dom.minidom now complies with this
+requirement.
More information about the Python-checkins
mailing list