8000 gh-111800: Fix `test_recursive_repr` from `test_io` under WASI to not… · python/cpython@974847b · GitHub
[go: up one dir, main page]

Skip to content

Commit 974847b

Browse files
authored
gh-111800: Fix test_recursive_repr from test_io under WASI to not recurse so deeply (GH-112150)
1 parent 762eb58 commit 974847b

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

Lib/test/test_io.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,11 +1234,9 @@ def test_recursive_repr(self):
12341234
# Issue #25455
12351235
raw = self.MockRawIO()
12361236
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):
12391239
repr(b) # Should not crash
1240-
except RuntimeError:
1241-
pass
12421240

12431241
def test_flush_error_on_close(self):
12441242
# Test that buffered file is closed despite failed flush
@@ -2801,11 +2799,9 @@ def test_recursive_repr(self):
28012799
# Issue #25455
28022800
raw = self.BytesIO()
28032801
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):
28062804
repr(t) # Should not crash
2807-
except RuntimeError:
2808-
pass
28092805

28102806
def test_line_buffering(self):
28112807
r = self.BytesIO()

0 commit comments

Comments
 (0)
0