pwd_getpwuid(), pwd_getpwnam(): Patch # 868499, improvement to the error

messages.
This commit is contained in:
Barry Warsaw 2004-01-20 21:07:23 +00:00
parent c7a7709321
commit e1b1c87636
1 changed files with 4 additions and 2 deletions

View File

@ -107,7 +107,8 @@ pwd_getpwuid(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "i:getpwuid", &uid))
return NULL;
if ((p = getpwuid(uid)) == NULL) {
PyErr_SetString(PyExc_KeyError, "getpwuid(): uid not found");
PyErr_Format(PyExc_KeyError,
"getpwuid(): uid not found: %d", uid);
return NULL;
}
return mkpwent(p);
@ -127,7 +128,8 @@ pwd_getpwnam(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "s:getpwnam", &name))
return NULL;
if ((p = getpwnam(name)) == NULL) {
PyErr_SetString(PyExc_KeyError, "getpwnam(): name not found");
PyErr_Format(PyExc_KeyError,
"getpwnam(): name not found: %s", name);
return NULL;
}
return mkpwent(p);