Skip to content

gh-93018: Fix for the compatibility problems with expat started in 2.4.4, not just 2.4.5 #93022

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.

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions Lib/test/test_minidom.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
from test import support
import unittest

import pyexpat
import xml.parsers.expat
import xml.dom.minidom

from xml.dom.minidom import parse, Node, Document, parseString
from xml.dom.minidom import getDOMImplementation
from xml.parsers.expat import ExpatError


tstfile = support.findfile("test.xml", subdir="xmltestdata")
Expand Down Expand Up @@ -1149,10 +1148,10 @@ def testEncodings(self):

# Verify that character decoding errors raise exceptions instead
# of crashing
if pyexpat.version_info >= (2, 4, 5):
self.assertRaises(ExpatError, parseString,
if xml.parsers.expat.version_info >= (2, 4, 4):
self.assertRaises(xml.parsers.expat.ExpatError, parseString,
b'<fran\xe7ais></fran\xe7ais>')
self.assertRaises(ExpatError, parseString,
self.assertRaises(xml.parsers.expat.ExpatError, parseString,
b'<franais>Comment \xe7a va ? Tr\xe8s bien ?</franais>')
else:
self.assertRaises(UnicodeDecodeError, parseString,
Expand Down Expand Up @@ -1617,8 +1616,8 @@ def testEmptyXMLNSValue(self):
self.confirm(doc2.namespaceURI == xml.dom.EMPTY_NAMESPACE)

def testExceptionOnSpacesInXMLNSValue(self):
if pyexpat.version_info >= (2, 4, 5):
context = self.assertRaisesRegex(ExpatError, 'syntax error')
if xml.parsers.expat.version_info >= (2, 4, 4):
context = self.assertRaisesRegex(xml.parsers.expat.ExpatError, 'syntax error')
else:
context = self.assertRaisesRegex(ValueError, 'Unsupported syntax')

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix for the compatibility problems with expat started in 2.4.4, not just 2.4.5