From 1734d4b3319ceac7d22da0a771c749d2a2378577 Mon Sep 17 00:00:00 2001 From: Ari Krupnik Date: Wed, 6 Jun 2018 22:02:43 -0500 Subject: [PATCH 1/2] bpo-33274: Compliance with DOM L1: return removed attribute --- Lib/test/test_minidom.py | 2 +- Lib/xml/dom/minidom.py | 1 + .../next/Library/2018-06-06-22-01-33.bpo-33274.teYqv8.rst | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Library/2018-06-06-22-01-33.bpo-33274.teYqv8.rst diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py index a2cc8828461d3e..e91cdba1eb2eff 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 a5d813f932ace3..e44e04a069ecb4 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 00000000000000..6f91dccea6217e --- /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 From f176625bd1ac6598e5bf5cf4ec2d765b8730400c Mon Sep 17 00:00:00 2001 From: arikrupnik Date: Wed, 6 Jun 2018 23:05:04 -0500 Subject: [PATCH 2/2] Update 2018-06-06-22-01-33.bpo-33274.teYqv8.rst --- .../next/Library/2018-06-06-22-01-33.bpo-33274.teYqv8.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index 6f91dccea6217e..420652bddf6eb4 100644 --- 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 @@ -1,3 +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 +requirement.