]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix os.listdir(): _Py_dup() already raises an exception on error, no need to
authorVictor Stinner <victor.stinner@gmail.com>
Thu, 19 Dec 2013 12:24:49 +0000 (13:24 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Thu, 19 Dec 2013 12:24:49 +0000 (13:24 +0100)
raise a new exception

Modules/posixmodule.c

index a64285e9551d6b58207666024e877ba3612f9503..ec70948e22035cba4b707a4d01a4578ff6f48919 100644 (file)
@@ -3746,10 +3746,8 @@ _posix_listdir(path_t *path, PyObject *list)
     if (path->fd != -1) {
         /* closedir() closes the FD, so we duplicate it */
         fd = _Py_dup(path->fd);
-        if (fd == -1) {
-            list = posix_error();
-            goto exit;
-        }
+        if (fd == -1)
+            return NULL;
 
         return_str = 1;