GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Align XML backend and canonical libraries with Python 3.15 by youknowdot · Pull Request #9197 · RustPython/RustPython

Align XML backend and canonical libraries with Python 3.15 #9197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
youknowone merged 5 commits into RustPython:main from youknowdot:split/xml-backend-315
Oct 27, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

Align XML backend and canonical libraries with Python 3.15 #9197

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
5 commits
Select commit Hold shift + click to select a range
8293b00
Align XML parsing and libraries with Python 3.15
youknowdot Oct 19, 2026
73b1c69
Retire proven XML guards and sync canonical consumers
youknowdot Oct 19, 2026
1576b65
Rebase vendored xml onto 1.4.0
youknowone Oct 21, 2026
dcff68b
Replace vendored XML split with registry-backed compatibility
youknowdot Oct 27, 2026
4eb7a68
Remove stale SAX external resolver expected failure
youknowdot Oct 27, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

318 changes: 291 additions & 27 deletions 318 Lib/test/test_minidom.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -480,9 +480,16 @@ def testGetAttributeNS(self):
self.assertEqual(child2.getAttributeNS("http://www.python.org", "missing"),
'')

def testGetAttributeNode(self): pass
def testGetAttributeNode(self):
dom = parseString("<doc a='1'/>")
elem = dom.documentElement
attr = elem.getAttributeNode("a")
self.assertEqual(attr.name, "a")
self.assertEqual(attr.value, "1")
self.assertIs(attr.ownerElement, elem)
self.assertIsNone(elem.getAttributeNode("b"))
dom.unlink()

@unittest.expectedFailure # TODO: RUSTPYTHON
def testGetElementsByTagNameNS(self):
d="""<foo xmlns:minidom='http://pyxml.sf.net/minidom'>
<minidom:myelem/>
Expand Down Expand Up @@ -671,9 +678,34 @@ def testTextRepr(self):
self.assertEqual(str(el), repr(el))
self.assertEqual('<DOM Text node "\'foo\'">', str(el))

def testWriteText(self): pass
def testWriteText(self):
dom = parseString("<doc><a>text</a><b>&lt;&amp;&gt;</b></doc>")
elem = dom.documentElement
writer = io.StringIO()
elem.writexml(writer)
self.assertEqual(writer.getvalue(),
"<doc><a>text</a><b>&lt;&amp;&gt;</b></doc>")
writer = io.StringIO()
elem.writexml(writer, indent=" ", addindent=" ", newl="\n")
self.assertEqual(writer.getvalue(),
" <doc>\n"
" <a>text</a>\n"
" <b>&lt;&amp;&gt;</b>\n"
" </doc>\n")
dom.unlink()

def testDocumentElement(self): pass
def testDocumentElement(self):
dom = parseString("<!-- comment --><doc/><?pi data?>")
elem = dom.documentElement
self.assertEqual(elem.tagName, "doc")
self.assertIs(elem, dom.childNodes[1])
dom.unlink()

dom = Document()
self.assertIsNone(dom.documentElement)
elem = dom.appendChild(dom.createElement("doc"))
self.assertIs(dom.documentElement, elem)
dom.unlink()

def testTooManyDocumentElements(self):
doc = parseString("<doc/>")
Expand All @@ -683,25 +715,126 @@ def testTooManyDocumentElements(self):
elem.unlink()
doc.unlink()

def testCreateElementNS(self): pass
def testCreateElementNS(self):
dom = Document()
elem = dom.createElementNS("http://xml.python.org/ns", "p:elem")
self.assertEqual(elem.nodeType, Node.ELEMENT_NODE)
self.assertEqual(elem.tagName, "p:elem")
self.assertEqual(elem.nodeName, "p:elem")
self.assertEqual(elem.namespaceURI, "http://xml.python.org/ns")
self.assertEqual(elem.prefix, "p")
self.assertEqual(elem.localName, "elem")
self.assertIs(elem.ownerDocument, dom)
self.assertIsNone(elem.parentNode)

elem = dom.createElementNS("http://xml.python.org/ns", "elem")
self.assertEqual(elem.tagName, "elem")
self.assertIsNone(elem.prefix)
self.assertEqual(elem.localName, "elem")
dom.unlink()

def testCreateAttributeNS(self):
dom = Document()
attr = dom.createAttributeNS("http://xml.python.org/ns", "p:attr")
self.assertEqual(attr.nodeType, Node.ATTRIBUTE_NODE)
self.assertEqual(attr.name, "p:attr")
self.assertEqual(attr.nodeName, "p:attr")
self.assertEqual(attr.namespaceURI, "http://xml.python.org/ns")
self.assertEqual(attr.prefix, "p")
self.assertEqual(attr.localName, "attr")
self.assertEqual(attr.value, "")
self.assertIs(attr.ownerDocument, dom)
self.assertIsNone(attr.ownerElement)

elem = dom.appendChild(dom.createElement("doc"))
elem.setAttributeNode(attr)
self.assertIs(attr.ownerElement, elem)
self.assertIs(elem.getAttributeNodeNS("http://xml.python.org/ns",
"attr"), attr)
dom.unlink()

def testParse(self):
# parsing from a file object is tested in testParseFromBinaryFile
# and testParseFromTextFile
dom = parse(tstfile)
self.assertEqual(dom.nodeType, Node.DOCUMENT_NODE)
self.assertEqual(dom.documentElement.tagName, "HTML")
dom.unlink()

def testCreateAttributeNS(self): pass
self.assertRaises(ExpatError, parseString, "<doc>")

def testParse(self): pass
def testParseString(self):
dom = parseString("<doc>text</doc>")
self.assertEqual(dom.nodeType, Node.DOCUMENT_NODE)
self.assertEqual(dom.documentElement.tagName, "doc")
self.assertEqual(dom.documentElement.firstChild.data, "text")
dom.unlink()

def testParseString(self): pass
dom = parseString(b"<?xml version='1.0' encoding='utf-8'?>"
b"<doc>\xc3\xa9</doc>")
self.assertEqual(dom.documentElement.firstChild.data, "\xe9")
dom.unlink()

def testComment(self): pass
def testComment(self):
dom = Document()
comment = dom.createComment("comment")
self.assertEqual(comment.nodeType, Node.COMMENT_NODE)
self.assertEqual(comment.nodeName, "#comment")
self.assertEqual(comment.data, "comment")
self.assertEqual(comment.nodeValue, "comment")
self.assertIsNone(comment.attributes)
dom.appendChild(comment)
self.assertEqual(dom.toxml(),
'<?xml version="1.0" ?><!--comment-->')
dom.unlink()

def testAttrListItem(self): pass
dom = parseString("<doc><!--comment--></doc>")
comment = dom.documentElement.firstChild
self.assertEqual(comment.nodeType, Node.COMMENT_NODE)
self.assertEqual(comment.data, "comment")
dom.unlink()

def testAttrListItems(self): pass
def testAttrListItem(self):
dom = parseString("<doc a='1' b='2'/>")
attrs = dom.documentElement.attributes
self.assertEqual(attrs.item(0).name, "a")
self.assertEqual(attrs.item(1).name, "b")
self.assertIsNone(attrs.item(2))
dom.unlink()

def testAttrListItemNS(self): pass
def testAttrListItems(self):
dom = parseString("<doc a='1' b='2'/>")
attrs = dom.documentElement.attributes
self.assertEqual(attrs.items(), [("a", "1"), ("b", "2")])
dom.unlink()

def testAttrListKeys(self): pass
def testAttrListItemNS(self):
dom = parseString("<doc xmlns:p='http://xml.python.org/ns' "
"p:a='1' b='2'/>")
attrs = dom.documentElement.attributes
self.assertEqual(attrs.itemsNS(), [
((xml.dom.XMLNS_NAMESPACE, "p"), "http://xml.python.org/ns"),
(("http://xml.python.org/ns", "a"), "1"),
((None, "b"), "2"),
])
dom.unlink()

def testAttrListKeysNS(self): pass
def testAttrListKeys(self):
dom = parseString("<doc a='1' b='2'/>")
attrs = dom.documentElement.attributes
self.assertEqual(list(attrs.keys()), ["a", "b"])
dom.unlink()

def testAttrListKeysNS(self):
dom = parseString("<doc xmlns:p='http://xml.python.org/ns' "
"p:a='1' b='2'/>")
attrs = dom.documentElement.attributes
self.assertEqual(list(attrs.keysNS()), [
(xml.dom.XMLNS_NAMESPACE, "p"),
("http://xml.python.org/ns", "a"),
(None, "b"),
])
dom.unlink()

def testRemoveNamedItem(self):
doc = parseString("<doc a=''/>")
Expand All @@ -722,29 +855,161 @@ def testRemoveNamedItemNS(self):
self.assertRaises(xml.dom.NotFoundErr, attrs.removeNamedItemNS,
"http://xml.python.org/", "b")

def testAttrListValues(self): pass
def testAttrListValues(self):
dom = parseString("<doc a='1' b='2'/>")
attrs = dom.documentElement.attributes
self.assertEqual([attr.name for attr in attrs.values()], ["a", "b"])
self.assertEqual([attr.value for attr in attrs.values()], ["1", "2"])
dom.unlink()

def testAttrListLength(self): pass
def testAttrListLength(self):
dom = parseString("<doc a='1' b='2'/>")
attrs = dom.documentElement.attributes
self.assertEqual(attrs.length, 2)
self.assertEqual(len(attrs), 2)
dom.unlink()

def testAttrList__getitem__(self): pass
dom = parseString("<doc/>")
self.assertEqual(dom.documentElement.attributes.length, 0)
dom.unlink()

def testAttrList__setitem__(self): pass
def testAttrList__getitem__(self):
dom = parseString("<doc xmlns:p='http://xml.python.org/ns' "
"p:a='1' b='2'/>")
attrs = dom.documentElement.attributes
self.assertEqual(attrs["b"].value, "2")
self.assertEqual(attrs[("http://xml.python.org/ns", "a")].value, "1")
self.assertRaises(KeyError, attrs.__getitem__, "missing")
self.assertRaises(KeyError, attrs.__getitem__, (None, "missing"))
dom.unlink()

def testSetAttrValueandNodeValue(self): pass
def testAttrList__setitem__(self):
dom = parseString("<doc a='1'/>")
elem = dom.documentElement
attrs = elem.attributes
attrs["a"] = "2"
self.assertEqual(elem.getAttribute("a"), "2")
attrs["b"] = "3"
self.assertEqual(elem.getAttribute("b"), "3")
self.assertEqual(attrs.length, 2)

attr = dom.createAttribute("c")
attr.value = "4"
attrs["c"] = attr
self.assertIs(elem.getAttributeNode("c"), attr)
self.assertEqual(elem.getAttribute("c"), "4")
dom.unlink()

def testParseElement(self): pass
def testSetAttrValueandNodeValue(self):
dom = parseString("<doc a='1'/>")
attr = dom.documentElement.getAttributeNode("a")
self.assertEqual(attr.value, "1")
self.assertEqual(attr.nodeValue, "1")
attr.value = "2"
self.assertEqual(attr.nodeValue, "2")
attr.nodeValue = "3"
self.assertEqual(attr.value, "3")
self.assertEqual(dom.documentElement.getAttribute("a"), "3")
dom.unlink()

def testParseAttributes(self): pass
def testParseElement(self):
dom = parseString("<doc><child/><child/></doc>")
elem = dom.documentElement
self.assertEqual(elem.nodeType, Node.ELEMENT_NODE)
self.assertEqual(elem.tagName, "doc")
self.assertIsNone(elem.namespaceURI)
self.assertIs(elem.parentNode, dom)
self.assertIs(elem.ownerDocument, dom)
self.assertEqual([child.tagName for child in elem.childNodes],
["child", "child"])
dom.unlink()

def testParseElementNamespaces(self): pass
def testParseAttributes(self):
dom = parseString("<doc a='1' b='&amp;'/>")
elem = dom.documentElement
self.assertEqual(elem.getAttribute("a"), "1")
self.assertEqual(elem.getAttribute("b"), "&")
self.assertEqual(elem.getAttribute("missing"), "")
self.assertTrue(elem.hasAttribute("a"))
self.assertFalse(elem.hasAttribute("missing"))
attr = elem.getAttributeNode("a")
self.assertIsNone(attr.namespaceURI)
dom.unlink()

def testParseAttributeNamespaces(self): pass
def testParseElementNamespaces(self):
dom = parseString("<p:doc xmlns:p='http://xml.python.org/ns'"
" xmlns='http://xml.python.org/default'>"
"<child/></p:doc>")
elem = dom.documentElement
self.assertEqual(elem.tagName, "p:doc")
self.assertEqual(elem.namespaceURI, "http://xml.python.org/ns")
self.assertEqual(elem.prefix, "p")
self.assertEqual(elem.localName, "doc")
child = elem.getElementsByTagName("child")[0]
self.assertEqual(child.namespaceURI, "http://xml.python.org/default")
self.assertIsNone(child.prefix)
self.assertEqual(child.localName, "child")
dom.unlink()

def testParseProcessingInstructions(self): pass
def testParseAttributeNamespaces(self):
dom = parseString("<doc xmlns:p='http://xml.python.org/ns'"
" p:a='1' b='2'/>")
elem = dom.documentElement
self.assertEqual(elem.getAttributeNS("http://xml.python.org/ns", "a"),
"1")
self.assertEqual(elem.getAttributeNS(None, "b"), "2")
attr = elem.getAttributeNodeNS("http://xml.python.org/ns", "a")
self.assertEqual(attr.name, "p:a")
self.assertEqual(attr.prefix, "p")
self.assertEqual(attr.localName, "a")
declaration = elem.getAttributeNode("xmlns:p")
self.assertEqual(declaration.namespaceURI, xml.dom.XMLNS_NAMESPACE)
self.assertEqual(declaration.value, "http://xml.python.org/ns")
dom.unlink()

def testChildNodes(self): pass
def testParseProcessingInstructions(self):
# the content of a processing instruction is tested
# in testProcessingInstruction
dom = parseString("<?before data?><doc/><?after?>")
pi = dom.childNodes[0]
self.assertEqual(pi.nodeType, Node.PROCESSING_INSTRUCTION_NODE)
self.assertEqual(pi.target, "before")
self.assertEqual(pi.data, "data")
self.assertIs(pi.parentNode, dom)
pi = dom.childNodes[2]
self.assertEqual(pi.target, "after")
self.assertEqual(pi.data, "")
dom.unlink()

def testChildNodes(self):
dom = parseString("<doc>text<child/><!--comment--></doc>")
children = dom.documentElement.childNodes
self.assertEqual(len(children), 3)
self.assertEqual([child.nodeType for child in children],
[Node.TEXT_NODE, Node.ELEMENT_NODE, Node.COMMENT_NODE])
for child in children:
self.assertIs(child.parentNode, dom.documentElement)
dom.unlink()

dom = parseString("<doc/>")
self.assertEqual(len(dom.documentElement.childNodes), 0)
dom.unlink()

def testFirstChild(self):
dom = parseString("<doc><a/><b/></doc>")
elem = dom.documentElement
self.assertEqual(elem.firstChild.tagName, "a")
self.assertEqual(elem.lastChild.tagName, "b")
self.assertIs(elem.firstChild, elem.childNodes[0])
self.assertIs(elem.lastChild, elem.childNodes[-1])
self.assertIsNone(elem.firstChild.previousSibling)
self.assertIs(elem.firstChild.nextSibling, elem.lastChild)
dom.unlink()

def testFirstChild(self): pass
dom = parseString("<doc/>")
self.assertIsNone(dom.documentElement.firstChild)
self.assertIsNone(dom.documentElement.lastChild)
dom.unlink()

def testHasChildNodes(self):
dom = parseString("<doc><foo/></doc>")
Expand Down Expand Up @@ -1250,7 +1515,6 @@ def testNodeListItem(self):
"test NodeList.item()")
doc.unlink()

@unittest.expectedFailure # TODO: RUSTPYTHON
def testEncodings(self):
doc = parseString('<foo>&#x20ac;</foo>')
self.assertEqual(doc.toxml(),
Expand Down
3 changes: 0 additions & 3 deletions 3 Lib/test/test_pulldom.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def test_parse(self):
with open(tstfile, "rb") as fin:
list(pulldom.parse(fin))

@unittest.expectedFailure # TODO: RUSTPYTHON; implement DOM semantic
def test_parse_semantics(self):
"""Test DOMEventStream parsing semantics."""

Expand Down Expand Up @@ -103,7 +102,6 @@ def test_parse_semantics(self):
#evt, node = next(items)
#self.assertEqual(pulldom.END_DOCUMENT, evt)

@unittest.expectedFailure # TODO: RUSTPYTHON; pulldom.parseString(SMALL_SAMPLE) return iterator with tuple with 2 elements
def test_expandItem(self):
"""Ensure expandItem works as expected."""
items = pulldom.parseString(SMALL_SAMPLE)
Expand Down Expand Up @@ -300,7 +298,6 @@ class SAX2DOMTestCase(unittest.TestCase):
def confirm(self, test, testname="Test"):
self.assertTrue(test, testname)

@unittest.expectedFailure # TODO: RUSTPYTHON; read from stream io
def test_basic(self):
"""Ensure SAX2DOM can parse from a stream."""
with io.StringIO(SMALL_SAMPLE) as fin:
Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.