summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1991-12-24 13:28:38 (GMT)
committerGuido van Rossum <guido@python.org>1991-12-24 13:28:38 (GMT)
commit0e8e872ebf96b98b1a1539b2df9a83524562122c (patch)
treeb251ef78ecf26f18775ef6d519d5fa8c753c4352
parent3ea7412d38e077a984c18f5e7f0793c285e1e1c3 (diff)
downloadcpython-0e8e872ebf96b98b1a1539b2df9a83524562122c.zip
cpython-0e8e872ebf96b98b1a1539b2df9a83524562122c.tar.gz
cpython-0e8e872ebf96b98b1a1539b2df9a83524562122c.tar.bz2
Raise KeyError instead of RuntimeError when a uid or name (etc) is not found.
-rw-r--r--Modules/pwdmodule.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/pwdmodule.c b/Modules/pwdmodule.c
index d8efca8..64940b1 100644
--- a/Modules/pwdmodule.c
+++ b/Modules/pwdmodule.c
@@ -67,7 +67,7 @@ static object *pwd_getpwuid(self, args)
if (!getintarg(args, &uid))
return NULL;
if ((p = getpwuid(uid)) == NULL) {
- err_setstr(RuntimeError, "getpwuid(): uid not found");
+ err_setstr(KeyError, "getpwuid(): uid not found");
return NULL;
}
return mkpwent(p);
@@ -81,7 +81,7 @@ static object *pwd_getpwnam(self, args)
if (!getstrarg(args, &name))
return NULL;
if ((p = getpwnam(getstringvalue(name))) == NULL) {
- err_setstr(RuntimeError, "getpwnam(): name not found");
+ err_setstr(KeyError, "getpwnam(): name not found");
return NULL;
}
return mkpwent(p);
@@ -167,7 +167,7 @@ static object *grp_getgrgid(self, args)
if (!getintarg(args, &gid))
return NULL;
if ((p = getgrgid(gid)) == NULL) {
- err_setstr(RuntimeError, "getgrgid(): gid not found");
+ err_setstr(KeyError, "getgrgid(): gid not found");
return NULL;
}
return mkgrent(p);
@@ -181,7 +181,7 @@ static object *grp_getgrnam(self, args)
if (!getstrarg(args, &name))
return NULL;
if ((p = getgrnam(getstringvalue(name))) == NULL) {
- err_setstr(RuntimeError, "getgrnam(): name not found");
+ err_setstr(KeyError, "getgrnam(): name not found");
return NULL;
}
return mkgrent(p);