@@ -859,14 +859,14 @@ def test_set_alloc_tracker_maximum_amplification(self):
859859 # Use a max amplification factor likely to be below the real one.
860860 self .assertIsNone (p .SetAllocTrackerMaximumAmplification (1.0 ))
861861 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 )
863863
864864 # Re-create a parser as the current parser is now in an error state.
865865 p = expat .ParserCreate ()
866866 # Unconditionally enable maximum amplification factor.
867867 p .SetAllocTrackerActivationThreshold (0 )
868868 self .assertIsNone (p .SetAllocTrackerMaximumAmplification (10_000 ))
869- self .assertIsNotNone (p .Parse (payload ))
869+ self .assertIsNotNone (p .Parse (payload , True ))
870870
871871 def test_set_alloc_tracker_maximum_amplification_invalid (self ):
872872 parser = expat .ParserCreate ()
@@ -878,7 +878,7 @@ def test_set_alloc_tracker_maximum_amplification_invalid(self):
878878
879879 subparser = parser .ExternalEntityParserCreate (None )
880880 fsub = subparser .SetAllocTrackerMaximumAmplification
881- msg = re . escape ( "parser must be a root parser" )
881+ msg = "parser must be a root parser"
882882 self .assertRaisesRegex (expat .ExpatError , msg , fsub , 1.0 )
883883
884884 def test_set_alloc_tracker_activation_threshold (self ):
@@ -892,14 +892,14 @@ def test_set_alloc_tracker_activation_threshold(self):
892892 p .SetAllocTrackerActivationThreshold (MAX_ALLOC + 1 )
893893 self .assertIsNone (p .SetAllocTrackerMaximumAmplification (1.0 ))
894894 # Check that we never reach the activation threshold.
895- self .assertIsNotNone (p .Parse (payload ))
895+ self .assertIsNotNone (p .Parse (payload , True ))
896896
897897 p = expat .ParserCreate ()
898898 p .SetAllocTrackerActivationThreshold (MIN_ALLOC - 1 )
899899 # Check that we always reach the activation threshold.
900900 self .assertIsNone (p .SetAllocTrackerMaximumAmplification (1.0 ))
901901 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 )
903903
904904 def test_set_alloc_tracker_activation_threshold_overflow (self ):
905905 _testcapi = import_helper .import_module ("_testcapi" )
@@ -911,7 +911,7 @@ def test_set_alloc_tracker_activation_threshold_invalid(self):
911911 parser = expat .ParserCreate ()
912912 subparser = parser .ExternalEntityParserCreate (None )
913913 f = subparser .SetAllocTrackerActivationThreshold
914- msg = re . escape ( "parser must be a root parser" )
914+ msg = "parser must be a root parser"
915915 self .assertRaisesRegex (expat .ExpatError , msg , f , 12345 )
916916
917917
0 commit comments