summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_fileio.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-03-19 17:25:29 (GMT)
committerGitHub <noreply@github.com>2017-03-19 17:25:29 (GMT)
commita5af6e1af77ee0f9294c5776478a9c24d9fbab94 (patch)
treef4c9791260db737fea9da4f415d9facad9c96ae1 /Lib/test/test_fileio.py
parent77ed11552da3e01dd235b7d68988076866b1f604 (diff)
downloadcpython-a5af6e1af77ee0f9294c5776478a9c24d9fbab94.zip
cpython-a5af6e1af77ee0f9294c5776478a9c24d9fbab94.tar.gz
cpython-a5af6e1af77ee0f9294c5776478a9c24d9fbab94.tar.bz2
bpo-25455: Fixed crashes in repr of recursive buffered file-like objects. (#514)
Diffstat (limited to 'Lib/test/test_fileio.py')
-rw-r--r--Lib/test/test_fileio.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py
index 3da210a..57a0265 100644
--- a/Lib/test/test_fileio.py
+++ b/Lib/test/test_fileio.py
@@ -10,7 +10,7 @@ from weakref import proxy
from functools import wraps
from test.support import (TESTFN, TESTFN_UNICODE, check_warnings, run_unittest,
- make_bad_fd, cpython_only)
+ make_bad_fd, cpython_only, swap_attr)
from collections import UserList
import _io # C implementation of io
@@ -176,6 +176,12 @@ class AutoFileTests:
finally:
os.close(fd)
+ def testRecursiveRepr(self):
+ # Issue #25455
+ with swap_attr(self.f, 'name', self.f):
+ with self.assertRaises(RuntimeError):
+ repr(self.f) # Should not crash
+
def testErrors(self):
f = self.f
self.assertFalse(f.isatty())