Skip to content
This repository was archived by the owner on May 27, 2025. It is now read-only.

Commit ff97dd0

Browse files
committed
Fix logic bug with first_time loop.
1 parent 4add6d3 commit ff97dd0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

posixmodule_scandir_main.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/*
22
Ben's notes:
33
4+
TODO: fix bug with iterating a second time (what should happen?)
5+
46
* three files should be #included in posixmodule.c
57
- posixmodule_scandir_main.c (this file) after posix_set_blocking
68
- posixmodule_scandir_methods.c at end of posix_methods (before Sentinel)
@@ -448,8 +450,6 @@ ScandirIterator_iternext(ScandirIterator *iterator)
448450

449451
while (1) {
450452
if (!iterator->first_time) {
451-
iterator->first_time = 0;
452-
453453
Py_BEGIN_ALLOW_THREADS
454454
success = FindNextFileW(iterator->handle, file_data);
455455
Py_END_ALLOW_THREADS
@@ -469,6 +469,7 @@ ScandirIterator_iternext(ScandirIterator *iterator)
469469
}
470470

471471
/* Loop till we get a non-dot directory or finish iterating */
472+
iterator->first_time = 0;
472473
}
473474

474475
Py_BEGIN_ALLOW_THREADS

0 commit comments

Comments
 (0)