Message341253
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:27 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, scoder, abarry |
2019-05-02 08:01:27 | serhiy.storchaka | set | messageid: <1556784087.84.0.218369710863.issue25707@roundup.psfhosted.org> |
2019-05-02 08:01:27 | serhiy.storchaka | link | issue25707 messages |
2019-05-02 08:01:27 | serhiy.storchaka | create | |
|