Message350589
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. |
|
Date |
User |
Action |
Args |
2019-08-27 03:45:28 | hongweipeng | set | recipients:
+ hongweipeng, brett.cannon, pitrou, Shai |
2019-08-27 03:45:28 | hongweipeng | set | messageid: <1566877528.39.0.644768307095.issue37935@roundup.psfhosted.org> |
2019-08-27 03:45:28 | hongweipeng | link | issue37935 messages |
2019-08-27 03:45:28 | hongweipeng | create | |
|