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 serhiy.storchaka
Recipients abarry, scoder, serhiy.storchaka
Date 2019-05-02.08:01:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Implicit closing an exhausted iterator helps only the iterator is iterated to the end. If the iteration has been stopped before the end, we get a leak of the file descriptor. Closing the file descriptor in the finalizer can be deferred to undefined term, especially in implementations without reference counting. Since file descriptors are limited resource, this can cause troubles in real programs.

Reasons for close() in iterparse objects are the same as for close in files and generators.

Maybe we will need to implement the full generator protocol (send() and throw()) in the iterparse objects, but currently I do not know use cases for this.
Date User Action Args
2019-05-02 08:01:27serhiy.storchakasetrecipients: + serhiy.storchaka, scoder, abarry
2019-05-02 08:01:27serhiy.storchakasetmessageid: <>
2019-05-02 08:01:27serhiy.storchakalinkissue25707 messages
2019-05-02 08:01:27serhiy.storchakacreate