diff options
author | Benjamin Peterson <benjamin@python.org> | 2019-11-12 23:54:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-12 23:54:19 (GMT) |
commit | 9788f97bf69230ec6b38a483c90e88828eba9a1b (patch) | |
tree | 8aed2b627f322c342d8e0df3aa65cb050c9f78ba /Lib/test/test_io.py | |
parent | 0a8e7fde064c8fb6eb8e78752d4bcdab56643065 (diff) | |
download | cpython-9788f97bf69230ec6b38a483c90e88828eba9a1b.zip cpython-9788f97bf69230ec6b38a483c90e88828eba9a1b.tar.gz cpython-9788f97bf69230ec6b38a483c90e88828eba9a1b.tar.bz2 |
[3.8] closes bpo-27805: Ignore ESPIPE in initializing seek of append-mode files. (GH-17136)
This change, which follows the behavior of C stdio's fdopen and Python 2's file object, allows pipes to be opened in append mode..
(cherry picked from commit 74fa9f723f700a342e582b5ad4b51a2c4801cd1c)
Diffstat (limited to 'Lib/test/test_io.py')
-rw-r--r-- | Lib/test/test_io.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index fc474c9..50459e0 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -3907,6 +3907,17 @@ class MiscIOTest(unittest.TestCase): f.close() g.close() + def test_open_pipe_with_append(self): + # bpo-27805: Ignore ESPIPE from lseek() in open(). + r, w = os.pipe() + self.addCleanup(os.close, r) + f = self.open(w, 'a') + self.addCleanup(f.close) + # Check that the file is marked non-seekable. On Windows, however, lseek + # somehow succeeds on pipes. + if sys.platform != 'win32': + self.assertFalse(f.seekable()) + def test_io_after_close(self): for kwargs in [ {"mode": "w"}, |