@@ -590,7 +590,7 @@ def test_denial_of_service_prevented_int_to_str(self):
590
590
digits = 78_268
591
591
with (
592
592
support .adjust_int_max_str_digits (digits ),
593
- support .CPUStopwatch () as sw_convert ):
593
+ support .Stopwatch () as sw_convert ):
594
594
huge_decimal = str (huge_int )
595
595
self .assertEqual (len (huge_decimal ), digits )
596
596
# Ensuring that we chose a slow enough conversion to measure.
@@ -605,7 +605,7 @@ def test_denial_of_service_prevented_int_to_str(self):
605
605
with support .adjust_int_max_str_digits (int (.995 * digits )):
606
606
with (
607
607
self .assertRaises (ValueError ) as err ,
608
- support .CPUStopwatch () as sw_fail_huge ):
608
+ support .Stopwatch () as sw_fail_huge ):
609
609
str (huge_int )
610
610
self .assertIn ('conversion' , str (err .exception ))
611
611
self .assertLessEqual (sw_fail_huge .seconds , sw_convert .seconds / 2 )
@@ -615,7 +615,7 @@ def test_denial_of_service_prevented_int_to_str(self):
615
615
extra_huge_int = int (f'0x{ "c" * 500_000 } ' , base = 16 ) # 602060 digits.
616
616
with (
617
617
self .assertRaises (ValueError ) as err ,
618
- support .CPUStopwatch () as sw_fail_extra_huge ):
618
+ support .Stopwatch () as sw_fail_extra_huge ):
619
619
# If not limited, 8 seconds said Zen based cloud VM.
620
620
str (extra_huge_int )
621
621
self .assertIn ('conversion' , str (err .exception ))
@@ -630,7 +630,7 @@ def test_denial_of_service_prevented_str_to_int(self):
630
630
huge = '8' * digits
631
631
with (
632
632
support .adjust_int_max_str_digits (digits ),
633
- support .CPUStopwatch () as sw_convert ):
633
+ support .Stopwatch () as sw_convert ):
634
634
int (huge )
635
635
# Ensuring that we chose a slow enough conversion to measure.
636
636
# It takes 0.1 seconds on a Zen based cloud VM in an opt build.
@@ -642,7 +642,7 @@ def test_denial_of_service_prevented_str_to_int(self):
642
642
with support .adjust_int_max_str_digits (digits - 1 ):
643
643
with (
644
644
self .assertRaises (ValueError ) as err ,
645
- support .CPUStopwatch () as sw_fail_huge ):
645
+ support .Stopwatch () as sw_fail_huge ):
646
646
int (huge )
647
647
self .assertIn ('conversion' , str (err .exception ))
648
648
self .assertLessEqual (sw_fail_huge .seconds , sw_convert .seconds / 2 )
@@ -652,7 +652,7 @@ def test_denial_of_service_prevented_str_to_int(self):
652
652
extra_huge = '7' * 1_200_000
653
653
with (
654
654
self .assertRaises (ValueError ) as err ,
655
- support .CPUStopwatch () as sw_fail_extra_huge ):
655
+ support .Stopwatch () as sw_fail_extra_huge ):
656
656
# If not limited, 8 seconds in the Zen based cloud VM.
657
657
int (extra_huge )
658
658
self .assertIn ('conversion' , str (err .exception ))
0 commit comments