circuitpython/tests/extmod/vfs_lfs_ilistdir_del.py.exp
Andrew Leech 4e0964b59f extmod/vfs: Add finaliser to ilistdir to close directory handle.
When iterating over filesystem/folders with os.iterdir(), an open file
(directory) handle is used internally.  Currently this file handle is only
closed once the iterator is completely drained, eg. once all entries have
been looped over / converted into list etc.

If a program opens an iterdir but does not loop over it, or starts to loop
over the iterator but breaks out of the loop, then the handle never gets
closed.  In this state, when the iter object is cleaned up by the garbage
collector this open handle can cause corruption of the filesystem.

Fixes issues #6568 and #8506.
2022-09-13 13:00:42 +10:00

31 lines
90 B
Plaintext

0
True
3
1
True
4
2
True
4
3
True
4
4
True
4
5
True
4
6
True
4
7
True
4
8
True
4
9
True
4