Martin Panter added the comment: Posting del-flush.patch, which only calls flush() instead of close() from __del__(), except for the FileIO class. Quick analysis of resulting test failures:
These tests fail because they are obviously written to test that __del__ calls close(): * IOTest.test_IOBase_destructor * IOTest.test_RawIOBase_destructor * IOTest.test_BufferedIOBase_destructor * IOTest.test_TextIOBase_destructor * test_override_destructor as mentioned above CBufferedReader/Writer/RandomTest.test_garbage_collection() fail because they do not free the reference to the wrapped raw file object. Similarly, CTextIOWrapperTest.test_garbage_collection() holds references to both levels of wrapped object. TextIOWrapperTest.test_destructor() fails because it assumes the wrapped close() will be called. The data is still written to the wrapped file though. MiscIOTest.test_warn_on_dealloc/_fd() fail because the warning message only refers to the FileIO object rather than the wrapper object. ---------- Added file: http://bugs.python.org/file38135/del-flush.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19829> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com