[New-bugs-announce] [issue46933] Make pwd module optional for wasm32-emscripten and wasi

Christian Heimes report at bugs.python.org
Sat Mar 5 15:50:25 EST 2022


New submission from Christian Heimes <lists at cheimes.de>:

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.

----------
assignee: christian.heimes
components: Library (Lib)
messages: 414595
nosy: christian.heimes
priority: normal
severity: normal
status: open
title: Make pwd module optional for wasm32-emscripten and wasi
type: behavior
versions: Python 3.11

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46933>
_______________________________________


More information about the New-bugs-announce mailing list