diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-03-24 23:21:57 +0200 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-03-24 23:21:57 +0200 |
commit | 7665be6087d879a96c4238684b2dfc642c67e60c (patch) | |
tree | e0b51ca3e484cd4717ed04857935a018234a3d9b /Lib/_pyio.py | |
parent | 8ffe917cee26b83fed4f227c4ed16d4eec15dcf9 (diff) | |
download | cpython-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.py | 6 |
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() |