Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8750d48

Browse files
Fix os.scandir().
1 parent 236f608 commit 8750d48

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

Modules/posixmodule.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12236,11 +12236,7 @@ DirEntry_fetch_stat(DirEntry *self, int follow_symlinks)
1223612236
result = fstatat(self->dir_fd, path, &st,
1223712237
follow_symlinks ? 0 : AT_SYMLINK_NOFOLLOW);
1223812238
#else
12239-
#if defined(MS_WINDOWS) && !USE_UNICODE_WCHAR_CACHE
12240-
PyMem_Free(path);
12241-
#else /* USE_UNICODE_WCHAR_CACHE */
1224212239
Py_DECREF(ub);
12243-
#endif /* USE_UNICODE_WCHAR_CACHE */
1224412240
PyErr_SetString(PyExc_NotImplementedError, "can't fetch stat");
1224512241
return NULL;
1224612242
#endif /* HAVE_FSTATAT */
@@ -13053,9 +13049,9 @@ os_scandir_impl(PyObject *module, path_t *path)
1305313049
#else /* POSIX */
1305413050
errno = 0;
1305513051
#ifdef HAVE_FDOPENDIR
13056-
if (path->fd != -1) {
13052+
if (iterator->path.fd != -1) {
1305713053
/* closedir() closes the FD, so we duplicate it */
13058-
fd = _Py_dup(path->fd);
13054+
fd = _Py_dup(iterator->path.fd);
1305913055
if (fd == -1)
1306013056
goto error;
1306113057

0 commit comments

Comments
 (0)