[New-bugs-announce] [issue34044] subprocess: reusing STARTUPINFO breaks under 3.7 (Windows)
Sebastian Bank
report at bugs.python.org
Wed Jul 4 10:55:46 EDT 2018
New submission from Sebastian Bank <sebastian.bank at uni-leipzig.de>:
AFAIU, the change for https://bugs.python.org/issue19764 broke the following usage of subprocess on Windows (re-using a subprocess.STARTUPINFO instance to hide the command window):
import os, subprocess
STARTUPINFO = subprocess.STARTUPINFO()
STARTUPINFO.dwFlags |= subprocess.STARTF_USESHOWWINDOW
STARTUPINFO.wShowWindow = subprocess.SW_HIDE
# raises OSError: [WinError 87]
# in the second loop iteration starting with Python 3.7
for i in range(2):
print(i)
with open(os.devnull, 'w') as stderr:
subprocess.check_call(['attrib'], stderr=stderr,
startupinfo=STARTUPINFO)
AFAICT, this works on Python 2.7, 3.4, 3.5, and 3.6
I think the documentation in
https://docs.python.org/3/library/subprocess.html#windows-popen-helpers
does not mention that every Popen call should be done with a fresh instance, so either the documentation needs to be changed, or the implementation (e.g. by deep-copying the instance).
See also https://bugs.python.org/issue19764#msg320784
----------
components: Library (Lib)
messages: 321047
nosy: eryksun, vstinner, xflr6
priority: normal
severity: normal
status: open
title: subprocess: reusing STARTUPINFO breaks under 3.7 (Windows)
type: behavior
versions: Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34044>
_______________________________________
More information about the New-bugs-announce
mailing list