This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author christian.heimes
Recipients christian.heimes
Date 2022-03-05.20:50:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1646513425.19.0.684732114682.issue46933@roundup.psfhosted.org>
In-reply-to
Content
WebAssembly platforms like wasm32-emscripten and wasm32-wasi don't have a typical user and group database.

WASI platform does not provide necessary API functions at all. Emscripten provides dummy stubs. On Emscripten the pwd module compiles, but is non-functional:

Python 3.11.0a4+ (heads/main-dirty:b1a3446, Jan 25 2022, 10:19:07) [Clang 14.0.0 (https://github.com/llvm/llvm-project f142c45f1e494f8dbdcc1bcf1412 on emscripten
Type "help", "copyright", "credits" or "license" for more information.
>>> import pwd, os
>>> os.getuid()
0
>>> pwd.getpwall()
[]
>>> pwd.getpwuid(os.getuid())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: 'getpwuid(): uid not found: 0'

I propose to make the pwd optional and catch import error in few places where the pwd module is used to look up user home directory.
History
Date User Action Args
2022-03-05 20:50:25christian.heimessetrecipients: + christian.heimes
2022-03-05 20:50:25christian.heimessetmessageid: <1646513425.19.0.684732114682.issue46933@roundup.psfhosted.org>
2022-03-05 20:50:25christian.heimeslinkissue46933 messages
2022-03-05 20:50:25christian.heimescreate