@@ -859,14 +859,14 @@ def test_set_alloc_tracker_maximum_amplification(self):
859
859
# Use a max amplification factor likely to be below the real one.
860
860
self .assertIsNone (p .SetAllocTrackerMaximumAmplification (1.0 ))
861
861
msg = r"out of memory: line \d+, column \d+"
862
- self .assertRaisesRegex (expat .ExpatError , msg , p .Parse , payload )
862
+ self .assertRaisesRegex (expat .ExpatError , msg , p .Parse , payload , True )
863
863
864
864
# Re-create a parser as the current parser is now in an error state.
865
865
p = expat .ParserCreate ()
866
866
# Unconditionally enable maximum amplification factor.
867
867
p .SetAllocTrackerActivationThreshold (0 )
868
868
self .assertIsNone (p .SetAllocTrackerMaximumAmplification (10_000 ))
869
- self .assertIsNotNone (p .Parse (payload ))
869
+ self .assertIsNotNone (p .Parse (payload , True ))
870
870
871
871
def test_set_alloc_tracker_maximum_amplification_invalid (self ):
872
872
parser = expat .ParserCreate ()
@@ -878,7 +878,7 @@ def test_set_alloc_tracker_maximum_amplification_invalid(self):
878
878
879
879
subparser = parser .ExternalEntityParserCreate (None )
880
880
fsub = subparser .SetAllocTrackerMaximumAmplification
881
- msg = re . escape ( "parser must be a root parser" )
881
+ msg = "parser must be a root parser"
882
882
self .assertRaisesRegex (expat .ExpatError , msg , fsub , 1.0 )
883
883
884
884
def test_set_alloc_tracker_activation_threshold (self ):
@@ -892,14 +892,14 @@ def test_set_alloc_tracker_activation_threshold(self):
892
892
p .SetAllocTrackerActivationThreshold (MAX_ALLOC + 1 )
893
893
self .assertIsNone (p .SetAllocTrackerMaximumAmplification (1.0 ))
894
894
# Check that we never reach the activation threshold.
895
- self .assertIsNotNone (p .Parse (payload ))
895
+ self .assertIsNotNone (p .Parse (payload , True ))
896
896
897
897
p = expat .ParserCreate ()
898
898
p .SetAllocTrackerActivationThreshold (MIN_ALLOC - 1 )
899
899
# Check that we always reach the activation threshold.
900
900
self .assertIsNone (p .SetAllocTrackerMaximumAmplification (1.0 ))
901
901
msg = r"out of memory: line \d+, column \d+"
902
- self .assertRaisesRegex (expat .ExpatError , msg , p .Parse , payload )
902
+ self .assertRaisesRegex (expat .ExpatError , msg , p .Parse , payload , True )
903
903
904
904
def test_set_alloc_tracker_activation_threshold_overflow (self ):
905
905
_testcapi = import_helper .import_module ("_testcapi" )
@@ -911,7 +911,7 @@ def test_set_alloc_tracker_activation_threshold_invalid(self):
911
911
parser = expat .ParserCreate ()
912
912
subparser = parser .ExternalEntityParserCreate (None )
913
913
f = subparser .SetAllocTrackerActivationThreshold
914
- msg = re . escape ( "parser must be a root parser" )
914
+ msg = "parser must be a root parser"
915
915
self .assertRaisesRegex (expat .ExpatError , msg , f , 12345 )
916
916
917
917
0 commit comments