diff options
author | Nikita Sobolev <mail@sobolevn.me> | 2023-11-16 19:47:38 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-16 19:47:38 (GMT) |
commit | 974847be443e9798615e197ec6642e546a71a6b0 (patch) | |
tree | 06b5b133213f59515db1847705624e61c56536a1 | |
parent | 762eb58220992d1ab809b9a281d47c0cd48a5aec (diff) | |
download | cpython-974847be443e9798615e197ec6642e546a71a6b0.zip cpython-974847be443e9798615e197ec6642e546a71a6b0.tar.gz cpython-974847be443e9798615e197ec6642e546a71a6b0.tar.bz2 |
gh-111800: Fix `test_recursive_repr` from `test_io` under WASI to not recurse so deeply (GH-112150)
-rw-r--r-- | Lib/test/test_io.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index ab33892..09cced9 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -1234,11 +1234,9 @@ class CommonBufferedTests: # Issue #25455 raw = self.MockRawIO() b = self.tp(raw) - with support.swap_attr(raw, 'name', b): - try: + with support.swap_attr(raw, 'name', b), support.infinite_recursion(25): + with self.assertRaises(RuntimeError): repr(b) # Should not crash - except RuntimeError: - pass def test_flush_error_on_close(self): # Test that buffered file is closed despite failed flush @@ -2801,11 +2799,9 @@ class TextIOWrapperTest(unittest.TestCase): # Issue #25455 raw = self.BytesIO() t = self.TextIOWrapper(raw, encoding="utf-8") - with support.swap_attr(raw, 'name', t): - try: + with support.swap_attr(raw, 'name', t), support.infinite_recursion(25): + with self.assertRaises(RuntimeError): repr(t) # Should not crash - except RuntimeError: - pass def test_line_buffering(self): r = self.BytesIO() |