[issue5700] io.FileIO calls flush() after file closed

2015-02-22 Thread Roundup Robot
Roundup Robot added the comment: New changeset bf52f69d6948 by Serhiy Storchaka in branch '2.7': Broke reference loops in tests added in issue #5700. https://hg.python.org/cpython/rev/bf52f69d6948 New changeset 00bde0743690 by Serhiy Storchaka in branch '3.4': Broke reference loops in tests adde

[issue5700] io.FileIO calls flush() after file closed

2015-02-20 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ __

[issue5700] io.FileIO calls flush() after file closed

2015-02-20 Thread Roundup Robot
Roundup Robot added the comment: New changeset 7052206ad381 by Serhiy Storchaka in branch '2.7': Issue #5700: io.FileIO() called flush() after closing the file. https://hg.python.org/cpython/rev/7052206ad381 New changeset 36f5c36b7704 by Serhiy Storchaka in branch '3.4': Issue #5700: io.FileIO()

[issue5700] io.FileIO calls flush() after file closed

2015-02-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Agree, the test in test_fileio is redundant. -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue5700] io.FileIO calls flush() after file closed

2015-02-15 Thread Martin Panter
Martin Panter added the comment: For the record, the python-dev thread referenced in the original post is . The obvious fix to me is to have FileIO.close() call IOBase.close() to invoke the flush() before continuing with its

[issue5700] io.FileIO calls flush() after file closed

2015-02-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: And here is a patch for 2.7. -- Added file: http://bugs.python.org/file38148/fileio_flush_closed-2.7.patch ___ Python tracker ___ _

[issue5700] io.FileIO calls flush() after file closed

2015-02-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Added comments as Antoine suggested. -- versions: +Python 2.7 Added file: http://bugs.python.org/file38147/fileio_flush_closed_2.patch ___ Python tracker _

[issue5700] io.FileIO calls flush() after file closed

2015-01-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Ping. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python

[issue5700] io.FileIO calls flush() after file closed

2014-10-12 Thread Serhiy Storchaka
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

[issue5700] io.FileIO calls flush() after file closed

2014-10-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There is complete implementation of FileIO in pure Python in issue21859. It is free from this bug. >>> import _pyio as io >>> class MyIO(io.FileIO): ... def flush(self): ... print('closed:', self.closed) ... >>> f = MyIO('test.out', 'wb') >>>

[issue5700] io.FileIO calls flush() after file closed

2011-06-26 Thread Terry J. Reedy
Terry J. Reedy added the comment: The original snippet works the same on 3.2.0. Was their any conclusion as to whether or not a change should be made? -- nosy: +terry.reedy versions: +Python 3.2, Python 3.3 -Python 3.1 ___ Python tracker

[issue5700] io.FileIO calls flush() after file closed

2009-04-12 Thread Brian Quinlan
Brian Quinlan added the comment: Oops, I didn't finish my thought: >> No, doing this is trivial. But shouldn't it be up to the implementor of >> MyClass to decide whether MyMixin or io.FileIO methods are evaluated first? > > Is there a concrete use case, though? I don't have a good one in mi

[issue5700] io.FileIO calls flush() after file closed

2009-04-12 Thread Brian Quinlan
Brian Quinlan added the comment: Antoine Pitrou wrote: > Antoine Pitrou added the comment: > >> No, doing this is trivial. But shouldn't it be up to the implementor of >> MyClass to decide whether MyMixin or io.FileIO methods are evaluated first? > > Is there a concrete use case, though? I

[issue5700] io.FileIO calls flush() after file closed

2009-04-12 Thread Antoine Pitrou
Antoine Pitrou added the comment: > No, doing this is trivial. But shouldn't it be up to the implementor of > MyClass to decide whether MyMixin or io.FileIO methods are evaluated first? Is there a concrete use case, though? By the way, what if _pyio.FileIO inherited from io.FileIO instead of

[issue5700] io.FileIO calls flush() after file closed

2009-04-12 Thread Brian Quinlan
Brian Quinlan added the comment: Antoine Pitrou wrote: > Antoine Pitrou added the comment: > >> I think that this linearization is probably more useful: >> >> MyClass -> io.FileIO -> MyMixin -> IOBase > > But why not simply: > > MyClass -> MyMixin -> io.FileIO -> IOBase > > ? > Is there som

[issue5700] io.FileIO calls flush() after file closed

2009-04-12 Thread Brian Quinlan
Brian Quinlan added the comment: Antoine Pitrou wrote: > Antoine Pitrou added the comment: > >> It is necessary to make MI work. With out it the inheritance graph looks >> like this (using _pyio): >> >> >> io.IOBase_pyio.IOBase >> | | >> io.FileIO MyMixin >> |

[issue5700] io.FileIO calls flush() after file closed

2009-04-12 Thread Antoine Pitrou
Antoine Pitrou added the comment: > I think that this linearization is probably more useful: > > MyClass -> io.FileIO -> MyMixin -> IOBase But why not simply: MyClass -> MyMixin -> io.FileIO -> IOBase ? Is there something I'm missing that prevents you from doing this? > I'm not trying to ch

[issue5700] io.FileIO calls flush() after file closed

2009-04-12 Thread Antoine Pitrou
Antoine Pitrou added the comment: > It is necessary to make MI work. With out it the inheritance graph looks > like this (using _pyio): > > > io.IOBase_pyio.IOBase > | | > io.FileIO MyMixin > | | > \/ > \ / >\

[issue5700] io.FileIO calls flush() after file closed

2009-04-12 Thread Brian Quinlan
Brian Quinlan added the comment: >> - FileIO is implemented in Python in _pyio.py so that it can have the >>same base class as the other Python-implemented files classes > Is it really necessary (e.g. to pass the tests)? It is necessary to make MI work. With out it the inheritance graph lo

[issue5700] io.FileIO calls flush() after file closed

2009-04-12 Thread Antoine Pitrou
Antoine Pitrou added the comment: > - FileIO is implemented in Python in _pyio.py so that it can have the >same base class as the other Python-implemented files classes Is it really necessary (e.g. to pass the tests)? -- nosy: +pitrou ___ Python

[issue5700] io.FileIO calls flush() after file closed

2009-04-12 Thread Brian Quinlan
Brian Quinlan added the comment: cooperation.diff: - change the close method to call .flush() and then ._close() - only IOBase implements close() (though a subclass can override close without causing problems - so long as it calls super().close()) - .flush() invokes super().flush() - ._close()

[issue5700] io.FileIO calls flush() after file closed

2009-04-12 Thread Brian Quinlan
Changes by Brian Quinlan : Added file: http://bugs.python.org/file13677/cooperation.diff ___ Python tracker ___ ___ Python-bugs-list mailing li

[issue5700] io.FileIO calls flush() after file closed

2009-04-05 Thread Brian Quinlan
Brian Quinlan added the comment: Discussion about this bug is ongoing in python-dev. -- ___ Python tracker ___ ___ Python-bugs-list ma

[issue5700] io.FileIO calls flush() after file closed

2009-04-05 Thread Brian Quinlan
New submission from Brian Quinlan : >>> import io >>> class MyIO(io.FileIO): ... def flush(self): ... print('closed:', self.closed) ... >>> f = MyIO('test.out', 'wb') >>> f.close() closed: True IMHO, calling flush() after the file has already been closed is incorrect behaviour. S