]> granicus.if.org Git - python/commitdiff
Issue #29513: Fixed a reference leak in os.scandir() added in issue #29034.
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 9 Feb 2017 18:02:37 +0000 (20:02 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Thu, 9 Feb 2017 18:02:37 +0000 (20:02 +0200)
Modules/posixmodule.c

index dc3fb94c87146638019ff7eb3d966a694b7ece10..8f8ba255ec48f6ff5125691767aa7342bad754e9 100644 (file)
@@ -11865,7 +11865,6 @@ ScandirIterator_finalize(ScandirIterator *iterator)
         }
     }
 
-    Py_CLEAR(iterator->path.object);
     path_cleanup(&iterator->path);
 
     /* Restore the saved exception. */
@@ -11969,12 +11968,6 @@ posix_scandir(PyObject *self, PyObject *args, PyObject *kwargs)
                                      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;