summaryrefslogtreecommitdiff
path: root/Modules/spwdmodule.c
diff options
context:
space:
mode:
authordoko <doko@ubuntu.com>2017-01-31 13:51:21 +0100
committerdoko <doko@ubuntu.com>2017-01-31 13:51:21 +0100
commitf18049fe65b515378c7c051fc0b8e41c8cfd0f17 (patch)
treece101a13b494d9953b2a6b84046d2f6bb469b6de /Modules/spwdmodule.c
parentd273026aa0ab78e7eafec5bdfb5233afdb2c97c0 (diff)
parente0cb38ac4330d5e09b5e21c74c5d5e453af99a4f (diff)
downloadcpython-f18049fe65b515378c7c051fc0b8e41c8cfd0f17.tar.gz
merge 3.5
Diffstat (limited to 'Modules/spwdmodule.c')
-rw-r--r--Modules/spwdmodule.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/spwdmodule.c b/Modules/spwdmodule.c
index 4b9f3cd9b7..556a715a24 100644
--- a/Modules/spwdmodule.c
+++ b/Modules/spwdmodule.c
@@ -137,7 +137,10 @@ spwd_getspnam_impl(PyObject *module, PyObject *arg)
if (PyBytes_AsStringAndSize(bytes, &name, NULL) == -1)
goto out;
if ((p = getspnam(name)) == NULL) {
- PyErr_SetString(PyExc_KeyError, "getspnam(): name not found");
+ if (errno != 0)
+ PyErr_SetFromErrno(PyExc_OSError);
+ else
+ PyErr_SetString(PyExc_KeyError, "getspnam(): name not found");
goto out;
}
retval = mkspent(p);