[issue22996] Order of _io objects finalization can lose data in reference cycles

2021-11-27 Thread Irit Katriel
Irit Katriel added the comment: Reproduced on 3.11. -- nosy: +iritkatriel type: -> behavior versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.4, Python 3.5 ___ Python tracker

[issue22996] Order of _io objects finalization can lose data in reference cycles

2014-12-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Note that the same issue is exist with gzip, bz2, lzma, tarfile and zipfile (or even worse). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22996 ___

[issue22996] Order of _io objects finalization can lose data in reference cycles

2014-12-05 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22996 ___ ___ Python-bugs-list

[issue22996] Order of _io objects finalization can lose data in reference cycles

2014-12-05 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: Added file: http://bugs.python.org/file37371/gcgzipio.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22996 ___

[issue22996] Order of _io objects finalization can lose data in reference cycles

2014-12-04 Thread Antoine Pitrou
New submission from Antoine Pitrou: Spun off from issue #17852, which sticks to interpreter shutdown issue. There is a more general issue when e.g. a BufferedWriter can be finalized (tp_finalize) before the TextIOWrapper wrapping it if they belong to a reference chain, losing unflushed data.

[issue22996] Order of _io objects finalization can lose data in reference cycles

2014-12-04 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22996 ___ ___

[issue22996] Order of _io objects finalization can lose data in reference cycles

2014-12-04 Thread Josh Rosenberg
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

[issue22996] Order of _io objects finalization can lose data in reference cycles

2014-12-04 Thread Antoine Pitrou
Antoine Pitrou added the comment: I was thinking about weak backrefs. It's specialized for the io module but it would be fairly reliable, and not too complicated to implement. -- ___ Python tracker rep...@bugs.python.org

[issue22996] Order of _io objects finalization can lose data in reference cycles

2014-12-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think that reference loop breaker should be smarter. If we have a loop A ⇄ B → C → D then the order of the finalization of A and B is not defined, but B should be finalized before C and C before D. This should fix unintentional issues with chained io