summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-02-09 20:05:51 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2017-02-09 20:05:51 +0200
commit1330a5b6e3737f211deaedcb8cb2e12e6506ae39 (patch)
tree33a08d7059b0759e48a28f1874c7510bd6188c59
parent2a1d833d5da7fa7a01a2eef183b0a208ed019427 (diff)
downloadcpython-1330a5b6e3737f211deaedcb8cb2e12e6506ae39.tar.gz
Issue #29513: Fix outdated comment and remove redundand code is os.scandir().
-rw-r--r--Modules/posixmodule.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 48c3c7abb4..ffe4815d66 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -11856,7 +11856,6 @@ ScandirIterator_finalize(ScandirIterator *iterator)
}
}
- Py_CLEAR(iterator->path.object);
path_cleanup(&iterator->path);
/* Restore the saved exception. */
@@ -11968,12 +11967,9 @@ os_scandir_impl(PyObject *module, path_t *path)
#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;