Mercurial > cpython
changeset 106478:a3f8c5d172b4
Issue #29513: Fix outdated comment and remove redundand code is os.scandir(). [#29513]
author | Serhiy Storchaka <storchaka@gmail.com> |
---|---|
date | Thu, 09 Feb 2017 20:05:51 +0200 |
parents | 26af402c291f |
children | 73a7bc169329 |
files | Modules/posixmodule.c |
diffstat | 1 files changed, 3 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -11856,7 +11856,6 @@ ScandirIterator_finalize(ScandirIterator } } - Py_CLEAR(iterator->path.object); path_cleanup(&iterator->path); /* Restore the saved exception. */ @@ -11968,12 +11967,9 @@ os_scandir_impl(PyObject *module, path_t #endif memcpy(&iterator->path, path, sizeof(path_t)); - /* path_converter doesn't keep path.object around, so do it - manually for the lifetime of the iterator here (the refcount - is decremented in ScandirIterator_dealloc) - */ - Py_XINCREF(iterator->path.object); - Py_XINCREF(iterator->path.cleanup); + /* Move the ownership to iterator->path */ + path->object = NULL; + path->cleanup = NULL; #ifdef MS_WINDOWS iterator->first_time = 1;