Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • pypy pypy
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 668
    • Issues 668
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

Mercurial Paris conference scheduled ! Main event : 2022-09-22. Call for papers deadline: 2022-06-17.

  • PyPy
  • pypypypy
  • Issues
  • #3624

Closed
Open
Created Dec 27, 2021 by Tom Most@twm

Passing `bytes` to `pwd.getpwnam()` raises `TypeError` on CPython

The pwd.getpwnam() function looks up a user record by username, or raises KeyError . The username is supposed to be a str, and CPython raises TypeError if you pass another type, like bytes. PyPy 3.6 and 3.7 raise KeyError in this case. Additionally, PyPy's exception message doesn't use repr() on the key, so the type issue isn't apparent in the traceback:

builtins.KeyError: 'getpwnam(): name not found: i-am-bytes'

PyPy should check the type to match CPython's behavior. Raising KeyError is a Python 2 porting hazard, since the caller will usually catch that exception and treat it as if the user record is not present.

Discovered on this Twisted PR. See this failure of this test.

Edited Dec 28, 2021 by Matti Picus
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking