This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xflr6
Recipients eryksun, vstinner, xflr6
Date 2018-07-04.14:55:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1530716146.72.0.56676864532.issue34044@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2018-07-04 14:55:46xflr6setrecipients: + xflr6, vstinner, eryksun
2018-07-04 14:55:46xflr6setmessageid: <1530716146.72.0.56676864532.issue34044@psf.upfronthosting.co.za>
2018-07-04 14:55:46xflr6linkissue34044 messages
2018-07-04 14:55:46xflr6create