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 vstinner
Recipients arigo, neologix, nikratio, pitrou, serhiy.storchaka, tim.peters, vstinner
Date 2014-12-04.11:05:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1417691104.88.0.480478290737.issue17852@psf.upfronthosting.co.za>
In-reply-to
Content
> The problem is that the order of tp_finalize calls is arbitrary when there is a reference cycle

If we want to guaranty that all files are properly flushed at exit, the best option is to maintain a list of open files.

I'm not interested to implement that, it sounds too complex. For example, open("text.txt", "w") creates 3 objects: FileIO, BufferedWriter, TextIOWrapper. You have to register these 3 objects and flush them in the right order. Python is dynamic, you are free to modify objects, for example using the detach() method or by modifying the buffer attribute of the TextIOWrapper.

How do you decide which object should be flushed? In which order? We have to take care of signals, threads and forks, stay portable, etc.
History
Date User Action Args
2014-12-04 11:05:04vstinnersetrecipients: + vstinner, tim.peters, arigo, pitrou, nikratio, neologix, serhiy.storchaka
2014-12-04 11:05:04vstinnersetmessageid: <1417691104.88.0.480478290737.issue17852@psf.upfronthosting.co.za>
2014-12-04 11:05:04vstinnerlinkissue17852 messages
2014-12-04 11:05:04vstinnercreate