Skip to content

Commit 45e9343

Browse files
authored
GH-144739: Skip test_pyexpat.MemoryProtectionTest based on expat compile-time version, not runtime (#144740)
1 parent 31343cf commit 45e9343

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Lib/test/test_pyexpat.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,9 @@ def test_set_maximum_amplification__amplification_not_exceeded(self):
10691069
self.assertIsNotNone(parser.Parse(payload, True))
10701070

10711071

1072-
@unittest.skipIf(expat.version_info < (2, 7, 2), "requires Expat >= 2.7.2")
1072+
@unittest.skipIf(not hasattr(expat.XMLParserType,
1073+
"SetAllocTrackerMaximumAmplification"),
1074+
"requires Python compiled with Expat >= 2.7.2")
10731075
class MemoryProtectionTest(AttackProtectionTestBase, unittest.TestCase):
10741076

10751077
# NOTE: with the default Expat configuration, the billion laughs protection
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
When Python was compiled with system expat older then 2.7.2 but tests run
2+
with newer expat, still skip
3+
:class:`!test.test_pyexpat.MemoryProtectionTest`.

0 commit comments

Comments
 (0)