File tree 1 file changed +4
-8
lines changed
1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -1234,11 +1234,9 @@ def test_recursive_repr(self):
1234
1234
# Issue #25455
1235
1235
raw = self .MockRawIO ()
1236
1236
b = self .tp (raw )
1237
- with support .swap_attr (raw , 'name' , b ):
1238
- try :
1237
+ with support .swap_attr (raw , 'name' , b ), support . infinite_recursion ( 25 ) :
1238
+ with self . assertRaises ( RuntimeError ) :
1239
1239
repr (b ) # Should not crash
1240
- except RuntimeError :
1241
- pass
1242
1240
1243
1241
def test_flush_error_on_close (self ):
1244
1242
# Test that buffered file is closed despite failed flush
@@ -2801,11 +2799,9 @@ def test_recursive_repr(self):
2801
2799
# Issue #25455
2802
2800
raw = self .BytesIO ()
2803
2801
t = self .TextIOWrapper (raw , encoding = "utf-8" )
2804
- with support .swap_attr (raw , 'name' , t ):
2805
- try :
2802
+ with support .swap_attr (raw , 'name' , t ), support . infinite_recursion ( 25 ) :
2803
+ with self . assertRaises ( RuntimeError ) :
2806
2804
repr (t ) # Should not crash
2807
- except RuntimeError :
2808
- pass
2809
2805
2810
2806
def test_line_buffering (self ):
2811
2807
r = self .BytesIO ()
You can’t perform that action at this time.