summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-12-19 12:24:49 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-12-19 12:24:49 (GMT)
commitf326665fe7d89df3617b142749c195187ba56d0e (patch)
treeb77694cac798b138ae65d8d10c8a99e2158c2718
parentfeae73e13fb15b06a5f798ed153ed534077f0465 (diff)
downloadcpython-f326665fe7d89df3617b142749c195187ba56d0e.zip
cpython-f326665fe7d89df3617b142749c195187ba56d0e.tar.gz
cpython-f326665fe7d89df3617b142749c195187ba56d0e.tar.bz2
Fix os.listdir(): _Py_dup() already raises an exception on error, no need to
raise a new exception
-rw-r--r--Modules/posixmodule.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index a64285e..ec70948 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -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;