This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author nascheme
Recipients arigo, martin.panter, nascheme, neologix, nikratio, pitrou, serhiy.storchaka, tim.peters, vstinner, xgdomingo
Date 2017-12-14.19:27:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1513279621.33.0.213398074469.issue17852@psf.upfronthosting.co.za>
In-reply-to
Content
Attached is a script that triggers the non-flushing behaviour for me.  I don't think it is reliable since it depends on the order that FileIO AND BufferedWriter are finalized when the gc finds them in a reference cycle.

BTW, it is arguable that the root cause of this bug is that we no longer to topological ordering when calling finalizers.  Originally, the cycle GC would refuse to call __del__ methods because once they are part of a cycle, there is no defined topological ordering.  So, we linked that garage to gc.garbage rather than calling __del__ and have potentially undefined results.  Now the GC has been changed to call __del__ anyhow.   I haven't studied how this has been changed but this non-flushing bug is a result.  Having the buffer added to gc.garbage would also result in the data not being flushed but arguably it would be more understandable what's going on.  I'm not arguing that we should go back to that, just that current behaviour can be subtle and confusing.
History
Date User Action Args
2017-12-14 19:27:01naschemesetrecipients: + nascheme, tim.peters, arigo, pitrou, vstinner, nikratio, neologix, martin.panter, serhiy.storchaka, xgdomingo
2017-12-14 19:27:01naschemesetmessageid: <1513279621.33.0.213398074469.issue17852@psf.upfronthosting.co.za>
2017-12-14 19:27:01naschemelinkissue17852 messages
2017-12-14 19:27:01naschemecreate