Skip to content

Commit 6b33f55

Browse files
hartworkmcepl
authored andcommitted
test_xml_etree.py: Fix for Expat >=2.6.0 with reparse deferral
Fix etree XMLPullParser tests for Expat >=2.6.0 with reparse deferral Combined with gh#python/cpython!31453 bpo-46811: Make test suite support Expat >=2.4.5 (pythonGH-31453) Curly brackets were never allowed in namespace URIs according to RFC 3986, and so-called namespace-validating XML parsers have the right to reject them a invalid URIs. libexpat >=2.4.5 has become strcter in that regard due to related security issues; with ET.XML instantiating a namespace-aware parser under the hood, this test has no future in CPython. References: - https://datatracker.ietf.org/doc/html/rfc3968 - https://www.w3.org/TR/xml-names/ Also, test_minidom.py: Support Expat >=2.4.5 (cherry picked from commit 2cae938) Co-authored-by: Sebastian Pipping <[email protected]> Fixes: gh#python#115133 From-PR: gh#python/cpython!115138 Patch: CVE-2023-52425-libexpat-2.6.0-backport-15.6.patch
1 parent 878403d commit 6b33f55

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Lib/test/test_xml_etree.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,11 @@ def assert_event_tags(self, parser, expected):
10461046
expected)
10471047

10481048
def test_simple_xml(self):
1049-
for chunk_size in (None, 1, 5):
1049+
# if is_expat_2_6_0:
1050+
chunks = (None,)
1051+
# else:
1052+
# chunks = (None, 1, 5)
1053+
for chunk_size in chunks:
10501054
with self.subTest(chunk_size=chunk_size):
10511055
expected_events = []
10521056
parser = ET.XMLPullParser()

0 commit comments

Comments
 (0)