Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix not throwing the same error as CPython in test_pathlib.test_expanduser #5578

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions 7 extra_tests/snippets/stdlib_pwd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from testutils import assert_raises
youknowone marked this conversation as resolved.
Show resolved Hide resolved
import pwd

with assert_raises(KeyError):
fake_name = 'fake_user'
while pwd.getpwnam(fake_name):
fake_name += '1'
2 changes: 1 addition & 1 deletion 2 vm/src/stdlib/pwd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ mod pwd {
if pw_name.contains('\0') {
return Err(exceptions::cstring_error(vm));
}
let user = User::from_name(name.as_str()).map_err(|err| err.into_pyexception(vm))?;
let user = User::from_name(name.as_str()).ok().flatten();
let user = user.ok_or_else(|| {
vm.new_key_error(
vm.ctx
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.