diff -r 4f7845be9e23 Modules/spwdmodule.c --- a/Modules/spwdmodule.c Mon Aug 19 23:31:18 2013 +0200 +++ b/Modules/spwdmodule.c Tue Aug 20 22:21:02 2013 +0800 @@ -149,6 +149,11 @@ if ((d = PyList_New(0)) == NULL) return NULL; setspent(); + if (errno == EACCES) { + PyErr_SetString(PyExc_OSError, "getspall(): The caller does not " + "have permission to access the shadow password file"); + return NULL; + } while ((p = getspent()) != NULL) { PyObject *v = mkspent(p); if (v == NULL || PyList_Append(d, v) != 0) {