#175 Merged
Repository
andrewsmedina/numpypy numpypy
Branch
stdlib-2.7.4-pwd-fix
Repository
pypy/pypy pypy
Branch
stdlib-2.7.4

fixed support for pwd stdlib 2.7.4

Author
  1. Andrews Medina avatarAndrews Medina
Reviewers
Description
No description

Comments (5)

  1. Armin Rigo

    The logic in CPython seems more advanced. It accepts a number that is any unsigned integer that fits in a uid_t, or the special value -1, which is cast to uid_t.

  2. Armin Rigo

    See how pypy/module/posix/interp_posix.py does it for uids, e.g. how the function setuid() is implemented: with an unwrap_spec(arg=c_uid_t) and a call to check_uid_range(space, arg).

  3. Andrews Medina author

    Armin Rigo, I have looked the posix setuid implementation and I have a question. The setuid uses @unwrap_spec(arg=c_uid_t) and c_uid_t is a reference to int. In this case when a large int is passed how argument value the exception raised is the OverflowError but for pwd cpython raises the KeyError. How I do it?

  4. Armin Rigo

    Right, indeed, you can't use the unwrap_spec(arg=c_uid_t). So please just tweak your existing code:

    try:
        uid = space.int_w(w_uid)
    except OperationError, e:
        if e.match(space, space.w_OverflowError):
            raise OperationError(space.w_KeyError, ...)
        raise
    
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.