Message 308681 - Python tracker

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.

Content
Yeah, I think you are correct.  Currently files not part of reference cycles get properly flushed and closed by the reference counter.  Implementing my "buffer_register_flush" patch would cause files to be closed only by the cyclic garbage collector (if not explicitly closed).  That would mean a script that opens a large number of files could run out of file descriptors.  Basically, we lose one of the main advantages of reference counting.

Probably the GC should keep track of how many files are open and call collect() when a threshold is reached.  Still, forcing every file to be collected only by the cyclic GC seems too ugly of a solution to this issue.