]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-144739: Skip test_pyexpat.MemoryProtectionTest based on expat compile-time version...
authorMiro Hrončok <miro@hroncok.cz>
Wed, 4 Mar 2026 12:59:50 +0000 (13:59 +0100)
committerGitHub <noreply@github.com>
Wed, 4 Mar 2026 12:59:50 +0000 (13:59 +0100)
Lib/test/test_pyexpat.py
Misc/NEWS.d/next/Tests/2026-02-12-12-12-00.gh-issue-144739.-fx1tN.rst [new file with mode: 0644]

index 74a75458289b4dc37d02376049b6d291352bc79f..31bcee293b2b699652ae5bcd810ff7daa22d065a 100644 (file)
@@ -1069,7 +1069,9 @@ class ExpansionProtectionTest(AttackProtectionTestBase, unittest.TestCase):
         self.assertIsNotNone(parser.Parse(payload, True))
 
 
-@unittest.skipIf(expat.version_info < (2, 7, 2), "requires Expat >= 2.7.2")
+@unittest.skipIf(not hasattr(expat.XMLParserType,
+                             "SetAllocTrackerMaximumAmplification"),
+                 "requires Python compiled with Expat >= 2.7.2")
 class MemoryProtectionTest(AttackProtectionTestBase, unittest.TestCase):
 
     # NOTE: with the default Expat configuration, the billion laughs protection
diff --git a/Misc/NEWS.d/next/Tests/2026-02-12-12-12-00.gh-issue-144739.-fx1tN.rst b/Misc/NEWS.d/next/Tests/2026-02-12-12-12-00.gh-issue-144739.-fx1tN.rst
new file mode 100644 (file)
index 0000000..8c46ff1
--- /dev/null
@@ -0,0 +1,3 @@
+When Python was compiled with system expat older then 2.7.2 but tests run
+with newer expat, still skip
+:class:`!test.test_pyexpat.MemoryProtectionTest`.