Josh Rosenberg added the comment: What is the proposal? Global registration of file objects that should be flushed before cleanup when they participate in a reference cycle? Adding a special "__predel__" method as suggested in the linked bug? Weak backrefs for file objects that allow a child being destroyed to flush/close its parent (recursively) such that the top of the I/O wrapping chain is always flushed/closed first? Something else?
The underlying problem is that people don't use with statements or otherwise explicitly close their objects, and 99.9% of the time, they get away with it in CPython because of the deterministic reference counting for non-cycles and the finalizers. I'm not sure it's worth adding new complexity (to the interpreter or the I/O hierarchy) to address an issue that can be fixed by closing your files properly, which is already recommended practice. ---------- nosy: +josh.r _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22996> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com