]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] GH-144739: Skip test_pyexpat.MemoryProtectionTest based on expat compile-time...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 4 Mar 2026 19:47:34 +0000 (20:47 +0100)
committerGitHub <noreply@github.com>
Wed, 4 Mar 2026 19:47:34 +0000 (19:47 +0000)
[3.14] GH-144739: Skip test_pyexpat.MemoryProtectionTest based on expat compile-time version, not runtime (GH-144740) (GH-145494)

GH-144739: Skip test_pyexpat.MemoryProtectionTest based on expat compile-time version, not runtime (GH-144740)

(cherry picked from commit 45e9343d7eed1d9e784e731cc9af853fa8649e59)
(cherry picked from commit bcc2dd8d30eb20995186c756bdcd10a56a1bad1c)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Miro HronĨok <miro@hroncok.cz>
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 cd98407c3421d06b30e21da327382b9ee14a0ba9..6f6c85755be4520c9b6ae4e5d96886393dc5c61f 100644 (file)
@@ -998,7 +998,9 @@ class AttackProtectionTestBase(abc.ABC):
         self.assert_root_parser_failure(setter, 123.45)
 
 
-@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`.