Neil Schemenauer <nas-pyt...@arctrix.com> added the comment:

Using reversed chronological order would work in 99% of the cases probably but 
then you would have that rare case where it didn't work.  So, I'm not too keen 
on that approach.

I think this is a classic problem with finalization and GC, probably should do 
some actual reading of literature.  One idea that occurs to me is that the 
underlying file object could keep a weakref to the higher level (e.g. buffer) 
objects.  Then, if the underlying file gets closes, it could make sure to call 
flush on the higher level objects first.  The weakref would ensure that a ref 
cycle is not created.

----------

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

Reply via email to