diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2015-03-24 21:23:42 (GMT) |
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-03-24 21:23:42 (GMT) |
| commit | f95a57f9a19a4e593e87f34a5358372d5b6d08e8 (patch) | |
| tree | faa1442f8ce9b4f567c5cae0e19a4489a5666249 /Lib/_pyio.py | |
| parent | 40fd0e8d68352f9d28be2a6ad1d6d0ba93756dbf (diff) | |
| download | cpython-f95a57f9a19a4e593e87f34a5358372d5b6d08e8.zip cpython-f95a57f9a19a4e593e87f34a5358372d5b6d08e8.tar.gz cpython-f95a57f9a19a4e593e87f34a5358372d5b6d08e8.tar.bz2 | |
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 98091eb..a7f4301 100644 --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -1216,8 +1216,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() |
