cpython: dcf25060cae8 (original) (raw)

Mercurial > cpython

changeset 95184:dcf25060cae8 2.7

Issue #21802: The reader in BufferedRWPair now is closed even when closing writer failed in BufferedRWPair.close(). [#21802]

Serhiy Storchaka storchaka@gmail.com
date Tue, 24 Mar 2015 23:23:42 +0200
parents 1c19778123a3
children 9f4d2bdced9c
files Lib/_pyio.py Lib/test/test_io.py Misc/NEWS Modules/_io/bufferedio.c
diffstat 4 files changed, 69 insertions(+), 6 deletions(-)[+] [-] Lib/_pyio.py 6 Lib/test/test_io.py 45 Misc/NEWS 3 Modules/_io/bufferedio.c 21

line wrap: on

line diff

--- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -1216,8 +1216,10 @@ class BufferedRWPair(BufferedIOBase): return self.writer.flush() def close(self):

def isatty(self): return self.reader.isatty() or self.writer.isatty()

--- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -1495,6 +1495,51 @@ class BufferedRWPairTest(unittest.TestCa pair.close() self.assertTrue(pair.closed)

+

+

+ def test_isatty(self): class SelectableIsAtty(MockRawIO): def init(self, isatty):

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -21,6 +21,9 @@ Core and Builtins Library ------- +- Issue #21802: The reader in BufferedRWPair now is closed even when closing

--- a/Modules/_io/bufferedio.c +++ b/Modules/_io/bufferedio.c @@ -2200,12 +2200,25 @@ bufferedrwpair_writable(rwpair *self, Py static PyObject * bufferedrwpair_close(rwpair *self, PyObject *args) {

-

} static PyObject *