Serhiy Storchaka added the comment:

Yet one related bug is that flush() isn't called at all if the file was opened 
with closefd=False.

>>> import io, os
>>> class MyIO(io.FileIO):
...     def flush(self):
...         print('closed:', self.closed)
... 
>>> fd = os.open('test.out', os.O_WRONLY|os.O_CREAT)
>>> f = MyIO(fd, 'wb', closefd=False)
>>> f.close()

The proposed simple patch fixes both bugs.

----------
assignee:  -> serhiy.storchaka
components: +IO
stage:  -> patch review
type:  -> behavior
versions: +Python 3.4, Python 3.5 -Python 3.2, Python 3.3
Added file: http://bugs.python.org/file36889/fileio_flush_closed.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue5700>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to