astral-sh / astral-sh/python-build-standalone
Not respecting closed stdin
- Dominant language
- Python
- Stars
- 4.4k
- Forks
- 314
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 27
Description
When Python process is launched with a closed stdin descriptor, `sys.stdin` object is initialized as regular instead of being set to `None`.
For demonstration purpose, `ghcr.io/astral-sh/uv:debian` Docker image is used.
```sh
$ uv run --managed-python python -c 'import sys; print(sys.stdin)' <&-
<_io.TextIOWrapper name='' mode='r' encoding='utf-8'>
$ /usr/bin/python3 -c 'import sys; print(sys.stdin)' <&-
None
```
Ideally this behavior should be consistent with reference CPython implementation.
Oddly enough, using `--no-managed-python` with `uv run` also produces `TextIOWrapper` object. As well as running the installed Python directly without invoking `uv`.
Contributor guide
Assessment
This issue has not been assessed yet.