Author giampaolo.rodola
Recipients akuchling, giampaolo.rodola, loewis, serhiy.storchaka, vajrasky
Date 2014-01-09.21:06:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1389301610.6.0.818073715006.issue10388@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2014-01-09 21:06:50giampaolo.rodolasetrecipients: + giampaolo.rodola, loewis, akuchling, serhiy.storchaka, vajrasky
2014-01-09 21:06:50giampaolo.rodolasetmessageid: <1389301610.6.0.818073715006.issue10388@psf.upfronthosting.co.za>
2014-01-09 21:06:50giampaolo.rodolalinkissue10388 messages
2014-01-09 21:06:50giampaolo.rodolacreate