mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
Issue #29513: Fix outdated comment and remove redundand code is os.scandir().
This commit is contained in:
parent
c7a24a7330
commit
095ef73492
1 changed files with 3 additions and 7 deletions
|
|
@ -11856,7 +11856,6 @@ ScandirIterator_finalize(ScandirIterator *iterator)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_CLEAR(iterator->path.object);
|
|
||||||
path_cleanup(&iterator->path);
|
path_cleanup(&iterator->path);
|
||||||
|
|
||||||
/* Restore the saved exception. */
|
/* Restore the saved exception. */
|
||||||
|
|
@ -11968,12 +11967,9 @@ os_scandir_impl(PyObject *module, path_t *path)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
memcpy(&iterator->path, path, sizeof(path_t));
|
memcpy(&iterator->path, path, sizeof(path_t));
|
||||||
/* path_converter doesn't keep path.object around, so do it
|
/* Move the ownership to iterator->path */
|
||||||
manually for the lifetime of the iterator here (the refcount
|
path->object = NULL;
|
||||||
is decremented in ScandirIterator_dealloc)
|
path->cleanup = NULL;
|
||||||
*/
|
|
||||||
Py_XINCREF(iterator->path.object);
|
|
||||||
Py_XINCREF(iterator->path.cleanup);
|
|
||||||
|
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
iterator->first_time = 1;
|
iterator->first_time = 1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue