diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-12-19 13:24:49 +0100 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-12-19 13:24:49 +0100 |
commit | 85a977b1833e4d1b3af28218ebffcafa17558a62 (patch) | |
tree | 180b31e011c684e5f11abcc329b2f197e88cfe67 | |
parent | 9efb45e8d4250d3ef6cd0dc7c0fd7818eabba135 (diff) | |
download | cpython-85a977b1833e4d1b3af28218ebffcafa17558a62.tar.gz |
Fix os.listdir(): _Py_dup() already raises an exception on error, no need to
raise a new exception
-rw-r--r-- | Modules/posixmodule.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index a64285e955..ec70948e22 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; |