[issue43069] Python fails to read a script whose path is `/dev/fd/X`

2021-01-30 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: I would suggest to start digging from the following piece of code in `maybe_pyc_file()` (Python/pythonrun.c): int ispyc = 0; if (ftell(fp) == 0) { if (fread(buf, 1, 2, fp) == 2 && ((unsigned int)buf[1]<<8 | buf[0]) ==

[issue43069] Python fails to read a script whose path is `/dev/fd/X`

2021-01-30 Thread Ronald Oussoren
Ronald Oussoren added the comment: I can reproduce the issue on macOS 11.1. As you write: - running /dev/fd/X as a script fails silently if it refers to an smallish file - reading /dev/fd/X referring to the same smallish files works fine (the ``open('/dev/fd/9').read()`` scenario. If I

[issue43069] Python fails to read a script whose path is `/dev/fd/X`

2021-01-29 Thread Ciprian Dorin Craciun
New submission from Ciprian Dorin Craciun : Sometimes (especially from wrapper scripts) one would like to call Python with a script that should be read from a file-descriptor, like `python3 /dev/fd/9`; most likely the backing is a file in `TMPDIR` (perhaps unlinked, like `bash`'s "here