summaryrefslogtreecommitdiffstats
path: root/Lib/_pyio.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/_pyio.py')
-rw-r--r--Lib/_pyio.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/_pyio.py b/Lib/_pyio.py
index 40e0c9f..1b24ef9 100644
--- a/Lib/_pyio.py
+++ b/Lib/_pyio.py
@@ -409,7 +409,7 @@ class IOBase(metaclass=abc.ABCMeta):
"""Destructor. Calls close()."""
try:
closed = self.closed
- except Exception:
+ except AttributeError:
# If getting closed fails, then the object is probably
# in an unusable state, so ignore.
return
@@ -867,7 +867,7 @@ class _BufferedIOMixin(BufferedIOBase):
clsname = self.__class__.__qualname__
try:
name = self.name
- except Exception:
+ except AttributeError:
return "<{}.{}>".format(modname, clsname)
else:
return "<{}.{} name={!r}>".format(modname, clsname, name)
@@ -2083,13 +2083,13 @@ class TextIOWrapper(TextIOBase):
self.__class__.__qualname__)
try:
name = self.name
- except Exception:
+ except AttributeError:
pass
else:
result += " name={0!r}".format(name)
try:
mode = self.mode
- except Exception:
+ except AttributeError:
pass
else:
result += " mode={0!r}".format(mode)