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)
commit10e76b67c9bb2f6febeb7f264478532cbe985ecd (patch)
tree36cae1df94a9ed11666054c854ba45c754ac0133 /Lib/_pyio.py
parentfe3dc376fa73fce563be26417ea763b05115990b (diff)
downloadcpython-10e76b67c9bb2f6febeb7f264478532cbe985ecd.zip
cpython-10e76b67c9bb2f6febeb7f264478532cbe985ecd.tar.gz
cpython-10e76b67c9bb2f6febeb7f264478532cbe985ecd.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.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/_pyio.py b/Lib/_pyio.py
index d4cfb6e..01683f8 100644
--- a/Lib/_pyio.py
+++ b/Lib/_pyio.py
@@ -793,7 +793,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)
@@ -1561,13 +1561,13 @@ class TextIOWrapper(TextIOBase):
result = "<_pyio.TextIOWrapper"
try:
name = self.name
- except AttributeError:
+ except Exception:
pass
else:
result += " name={0!r}".format(name)
try:
mode = self.mode
- except AttributeError:
+ except Exception:
pass
else:
result += " mode={0!r}".format(mode)