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

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

(cherry picked from commit 45e9343d7e)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
This commit is contained in:
Victor Stinner 2026-03-04 20:23:56 +01:00 committed by GitHub
parent da3fea361e
commit bcc2dd8d30
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View file

@ -999,7 +999,9 @@ def test_set_maximum_amplification__fail_for_subparser(self):
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

View file

@ -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`.