Skip to content

Commit

Permalink
Issue python#29513: Fix outdated comment and remove redundand code is…
Browse files Browse the repository at this point in the history
… os.scandir().
  • Loading branch information
serhiy-storchaka committed Feb 9, 2017
1 parent c7a24a7 commit 095ef73
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -11856,7 +11856,6 @@ ScandirIterator_finalize(ScandirIterator *iterator)
}
}

Py_CLEAR(iterator->path.object);
path_cleanup(&iterator->path);

/* Restore the saved exception. */
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 095ef73

Please sign in to comment.