summaryrefslogtreecommitdiffstats
path: root/Lib/_pyio.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-12-22 02:51:50 (GMT)
committerBenjamin Peterson <benjamin@python.org>2014-12-22 02:51:50 (GMT)
commit53ae6145a0b8f3380f819bf1c60b5dfc676f05ec (patch)
treeb14f0b0cc4f3e49a5ab6e8a9444f068f12c08b30 /Lib/_pyio.py
parent4e9dbfba217301b20f0891746ba81556858f6495 (diff)
downloadcpython-53ae6145a0b8f3380f819bf1c60b5dfc676f05ec.zip
cpython-53ae6145a0b8f3380f819bf1c60b5dfc676f05ec.tar.gz
cpython-53ae6145a0b8f3380f819bf1c60b5dfc676f05ec.tar.bz2
allow more operations to work on detached streams (closes #23093)
Patch by Martin Panter.
Diffstat (limited to 'Lib/_pyio.py')
-rw-r--r--Lib/_pyio.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/_pyio.py b/Lib/_pyio.py
index 3acbc65..1c194d5 100644
--- a/Lib/_pyio.py
+++ b/Lib/_pyio.py
@@ -775,7 +775,7 @@ class _BufferedIOMixin(BufferedIOBase):
clsname = self.__class__.__name__
try:
name = self.name
- except AttributeError:
+ except Exception:
return "<_pyio.{0}>".format(clsname)
else:
return "<_pyio.{0} name={1!r}>".format(clsname, name)
@@ -1538,7 +1538,7 @@ class TextIOWrapper(TextIOBase):
def __repr__(self):
try:
name = self.name
- except AttributeError:
+ except Exception:
return "<_pyio.TextIOWrapper encoding='{0}'>".format(self.encoding)
else:
return "<_pyio.TextIOWrapper name={0!r} encoding='{1}'>".format(