Skip to content

Commit 516999e

Browse files
committed
Fix bug introduced in rev. 42884.
1 parent 437567c commit 516999e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Modules/posixmodule.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,7 +1640,7 @@ posix_listdir(PyObject *self, PyObject *args)
16401640

16411641
PyObject *d, *v;
16421642
HANDLE hFindFile;
1643-
BOOL result;
1643+
BOOL result = FALSE;
16441644
WIN32_FIND_DATA FileData;
16451645
/* MAX_PATH characters could mean a bigger encoded string */
16461646
char namebuf[MAX_PATH*2+5];
@@ -1679,7 +1679,7 @@ posix_listdir(PyObject *self, PyObject *args)
16791679
(wFileData.cFileName[1] == L'\0' ||
16801680
wFileData.cFileName[1] == L'.' &&
16811681
wFileData.cFileName[2] == L'\0'))
1682-
continue;
1682+
goto loop_w;
16831683
v = PyUnicode_FromUnicode(wFileData.cFileName, wcslen(wFileData.cFileName));
16841684
if (v == NULL) {
16851685
Py_DECREF(d);
@@ -1693,6 +1693,7 @@ posix_listdir(PyObject *self, PyObject *args)
16931693
break;
16941694
}
16951695
Py_DECREF(v);
1696+
loop_w:
16961697
Py_BEGIN_ALLOW_THREADS
16971698
result = FindNextFileW(hFindFile, &wFileData);
16981699
Py_END_ALLOW_THREADS
@@ -1736,7 +1737,7 @@ posix_listdir(PyObject *self, PyObject *args)
17361737
(FileData.cFileName[1] == '\0' ||
17371738
FileData.cFileName[1] == '.' &&
17381739
FileData.cFileName[2] == '\0'))
1739-
continue;
1740+
goto loop_a;
17401741
v = PyString_FromString(FileData.cFileName);
17411742
if (v == NULL) {
17421743
Py_DECREF(d);
@@ -1750,6 +1751,7 @@ posix_listdir(PyObject *self, PyObject *args)
17501751
break;
17511752
}
17521753
Py_DECREF(v);
1754+
loop_a:
17531755
Py_BEGIN_ALLOW_THREADS
17541756
result = FindNextFile(hFindFile, &FileData);
17551757
Py_END_ALLOW_THREADS

0 commit comments

Comments
 (0)