Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e1b1c87

Browse files
committed
pwd_getpwuid(), pwd_getpwnam(): Patch # 868499, improvement to the error
messages.
1 parent c7a7709 commit e1b1c87

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Modules/pwdmodule.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ pwd_getpwuid(PyObject *self, PyObject *args)
107107
if (!PyArg_ParseTuple(args, "i:getpwuid", &uid))
108108
return NULL;
109109
if ((p = getpwuid(uid)) == NULL) {
110-
PyErr_SetString(PyExc_KeyError, "getpwuid(): uid not found");
110+
PyErr_Format(PyExc_KeyError,
111+
"getpwuid(): uid not found: %d", uid);
111112
return NULL;
112113
}
113114
return mkpwent(p);
@@ -127,7 +128,8 @@ pwd_getpwnam(PyObject *self, PyObject *args)
127128
if (!PyArg_ParseTuple(args, "s:getpwnam", &name))
128129
return NULL;
129130
if ((p = getpwnam(name)) == NULL) {
130-
PyErr_SetString(PyExc_KeyError, "getpwnam(): name not found");
131+
PyErr_Format(PyExc_KeyError,
132+
"getpwnam(): name not found: %s", name);
131133
return NULL;
132134
}
133135
return mkpwent(p);

0 commit comments

Comments
 (0)