mirror of
https://github.com/python/cpython.git
synced 2025-10-13 02:13:03 +00:00
allow more operations to work on detached streams (closes #23093)
Patch by Martin Panter.
This commit is contained in:
parent
fe3dc376fa
commit
10e76b67c9
5 changed files with 61 additions and 42 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue