summaryrefslogtreecommitdiff
path: root/Lib/_pyio.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-03-24 23:21:57 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2015-03-24 23:21:57 +0200
commit7665be6087d879a96c4238684b2dfc642c67e60c (patch)
treee0b51ca3e484cd4717ed04857935a018234a3d9b /Lib/_pyio.py
parent8ffe917cee26b83fed4f227c4ed16d4eec15dcf9 (diff)
downloadcpython-git-7665be6087d879a96c4238684b2dfc642c67e60c.tar.gz
Issue #21802: The reader in BufferedRWPair now is closed even when closing
writer failed in BufferedRWPair.close().
Diffstat (limited to 'Lib/_pyio.py')
-rw-r--r--Lib/_pyio.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/_pyio.py b/Lib/_pyio.py
index 09aa78decd..3ed02e410d 100644
--- a/Lib/_pyio.py
+++ b/Lib/_pyio.py
@@ -1230,8 +1230,10 @@ class BufferedRWPair(BufferedIOBase):
return self.writer.flush()
def close(self):
- self.writer.close()
- self.reader.close()
+ try:
+ self.writer.close()
+ finally:
+ self.reader.close()
def isatty(self):
return self.reader.isatty() or self.writer.isatty()