Giampaolo Rodola' added the comment: Looking back at this: considering we may get errors != EACCESS I think we better be as generic as possible as in:
--- a/Modules/spwdmodule.c +++ b/Modules/spwdmodule.c @@ -153,6 +153,8 @@ if ((d = PyList_New(0)) == NULL) return NULL; setspent(); + if (errno != 0) + return PyErr_SetFromErrno(PyExc_OSError); while ((p = getspent()) != NULL) { PyObject *v = mkspent(p); if (v == NULL || PyList_Append(d, v) != 0) { As for 2.7 and 3.3 I have a little concern in terms of backward compatibility as the user will suddenly receive an exception instead of [] but I think that for the sake of correctness the cost is justified. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue10388> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com