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 hongweipeng
Recipients Shai, brett.cannon, hongweipeng, pitrou
Date 2019-08-27.03:45:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1566877528.39.0.644768307095.issue37935@roundup.psfhosted.org>
In-reply-to
Content
Scandir() will be close when it iteration is over.You can see ScandirIterator_iternext:

```
static PyObject *
ScandirIterator_iternext(ScandirIterator *iterator)
{
    while (1) {
        ...
    }
    /* Error or no more files */
    ScandirIterator_closedir(iterator);
    return NULL;
}
```

So, `entries = list(scandir(parent_path))` resources in this code can be properly closed.
History
Date User Action Args
2019-08-27 03:45:28hongweipengsetrecipients: + hongweipeng, brett.cannon, pitrou, Shai
2019-08-27 03:45:28hongweipengsetmessageid: <1566877528.39.0.644768307095.issue37935@roundup.psfhosted.org>
2019-08-27 03:45:28hongweipenglinkissue37935 messages
2019-08-27 03:45:28hongweipengcreate