Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
0e8e872e
Commit
0e8e872e
authored
Dec 24, 1991
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Raise KeyError instead of RuntimeError when a uid or name (etc) is not found.
parent
3ea7412d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
Modules/pwdmodule.c
Modules/pwdmodule.c
+4
-4
No files found.
Modules/pwdmodule.c
View file @
0e8e872e
...
@@ -67,7 +67,7 @@ static object *pwd_getpwuid(self, args)
...
@@ -67,7 +67,7 @@ static object *pwd_getpwuid(self, args)
if
(
!
getintarg
(
args
,
&
uid
))
if
(
!
getintarg
(
args
,
&
uid
))
return
NULL
;
return
NULL
;
if
((
p
=
getpwuid
(
uid
))
==
NULL
)
{
if
((
p
=
getpwuid
(
uid
))
==
NULL
)
{
err_setstr
(
Runtime
Error
,
"getpwuid(): uid not found"
);
err_setstr
(
Key
Error
,
"getpwuid(): uid not found"
);
return
NULL
;
return
NULL
;
}
}
return
mkpwent
(
p
);
return
mkpwent
(
p
);
...
@@ -81,7 +81,7 @@ static object *pwd_getpwnam(self, args)
...
@@ -81,7 +81,7 @@ static object *pwd_getpwnam(self, args)
if
(
!
getstrarg
(
args
,
&
name
))
if
(
!
getstrarg
(
args
,
&
name
))
return
NULL
;
return
NULL
;
if
((
p
=
getpwnam
(
getstringvalue
(
name
)))
==
NULL
)
{
if
((
p
=
getpwnam
(
getstringvalue
(
name
)))
==
NULL
)
{
err_setstr
(
Runtime
Error
,
"getpwnam(): name not found"
);
err_setstr
(
Key
Error
,
"getpwnam(): name not found"
);
return
NULL
;
return
NULL
;
}
}
return
mkpwent
(
p
);
return
mkpwent
(
p
);
...
@@ -167,7 +167,7 @@ static object *grp_getgrgid(self, args)
...
@@ -167,7 +167,7 @@ static object *grp_getgrgid(self, args)
if
(
!
getintarg
(
args
,
&
gid
))
if
(
!
getintarg
(
args
,
&
gid
))
return
NULL
;
return
NULL
;
if
((
p
=
getgrgid
(
gid
))
==
NULL
)
{
if
((
p
=
getgrgid
(
gid
))
==
NULL
)
{
err_setstr
(
Runtime
Error
,
"getgrgid(): gid not found"
);
err_setstr
(
Key
Error
,
"getgrgid(): gid not found"
);
return
NULL
;
return
NULL
;
}
}
return
mkgrent
(
p
);
return
mkgrent
(
p
);
...
@@ -181,7 +181,7 @@ static object *grp_getgrnam(self, args)
...
@@ -181,7 +181,7 @@ static object *grp_getgrnam(self, args)
if
(
!
getstrarg
(
args
,
&
name
))
if
(
!
getstrarg
(
args
,
&
name
))
return
NULL
;
return
NULL
;
if
((
p
=
getgrnam
(
getstringvalue
(
name
)))
==
NULL
)
{
if
((
p
=
getgrnam
(
getstringvalue
(
name
)))
==
NULL
)
{
err_setstr
(
Runtime
Error
,
"getgrnam(): name not found"
);
err_setstr
(
Key
Error
,
"getgrnam(): name not found"
);
return
NULL
;
return
NULL
;
}
}
return
mkgrent
(
p
);
return
mkgrent
(
p
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment