diff -r 975e03b0aea6 Modules/posixmodule.c --- a/Modules/posixmodule.c Tue Feb 07 11:27:48 2017 +0300 +++ b/Modules/posixmodule.c Thu Feb 09 15:29:14 2017 +0200 @@ -11865,7 +11865,6 @@ ScandirIterator_finalize(ScandirIterator } } - Py_CLEAR(iterator->path.object); path_cleanup(&iterator->path); /* Restore the saved exception. */ @@ -11969,12 +11968,6 @@ posix_scandir(PyObject *self, PyObject * path_converter, &iterator->path)) goto error; - /* 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); - #ifdef MS_WINDOWS iterator->first_time = 1;