[issue44572] Calls to platform._syscmd_ver() dependent functions consume STDIN

Константин Глухов report at bugs.python.org
Tue Jul 6 12:21:17 EDT 2021


New submission from Константин Глухов <glukhov.k at gmail.com>:

Starting with version 3.9.5 platform.win32* functions have been re-written and consume STDIN. The bug comes down to running 'ver', 'command /c ver', 'cmd /c ver' in platform._syscmd_ver() via subprocess.check_output().

The following code demonstrate the problem:

Python\396\python -c "import platform as p, sys;print(sys.stdin.tell());p.win32_ver();print(sys.stdin.tell())" < file
0
8000

All functions dependent on platform._syscmd_ver(), including platform.uname(), consume STDIN.

This behavior breaks all the scripts on Windows platform that have the calls mentioned above and use the following invocation:

python script.py < file

----------
components: IO, Library (Lib), Windows
messages: 397044
nosy: glukhov.k, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Calls to platform._syscmd_ver() dependent functions consume STDIN
type: behavior
versions: Python 3.9

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


More information about the Python-bugs-list mailing list