[Python-checkins] cpython: Issue #29513: Fix outdated comment and remove redundand code is os.scandir().

serhiy.storchaka python-checkins at python.org
Thu Feb 9 13:07:36 EST 2017


https://hg.python.org/cpython/rev/a3f8c5d172b4
changeset:   106478:a3f8c5d172b4
parent:      106475:26af402c291f
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Thu Feb 09 20:05:51 2017 +0200
summary:
  Issue #29513: Fix outdated comment and remove redundand code is os.scandir().

files:
  Modules/posixmodule.c |  10 +++-------
  1 files changed, 3 insertions(+), 7 deletions(-)


diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -11856,7 +11856,6 @@
         }
     }
 
-    Py_CLEAR(iterator->path.object);
     path_cleanup(&iterator->path);
 
     /* Restore the saved exception. */
@@ -11968,12 +11967,9 @@
 #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;

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list