gh-155358: Use named attributes with pwd and grp modules - #155362
gh-155358: Use named attributes with pwd and grp modules#155362vstinner wants to merge 2 commits into
Conversation
* Replace pwd[0] with pwd.pw_name * Replace pwd[2] with pwd.pw_uid * Replace grp[0] with grp.gr_name * Replace grp[2] with grp.gr_gid
There was a problem hiding this comment.
LGTM. Perhaps the only thing I would add is a test which checks that assert grp.getgrgid(...)[0] == grp.getgrgid(...).gr_name (and others). I didn't check, maybe it's already there.
Also, while you're there, perhaps you want to also make the replacement in other places? Like Lib/http/server.py (grep for getpwuid, getgrgid, and others under Lib/ to find all).
* Replace pwd[3] with pwd.pw_gid
test_pwd and test_grp already implement these checks.
Oh right, I missed some code. I updated the PR to replace more code. @giampaolo: Would you mind to review the updated PR? |
Documentation build overview
|
object[index]) of structseq types (ex: os.stat_result) #155358