[issue10388] spwd returning different value depending on privileges
Giampaolo Rodola'
report at bugs.python.org
Thu Jan 9 22:06:50 CET 2014
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 <report at bugs.python.org>
<http://bugs.python.org/issue10388>
_______________________________________
More information about the Python-bugs-list
mailing list