Message 315510 - Python tracker

Message315510

Author pekka.klarck
Recipients pekka.klarck
Date 2018-04-20.13:05:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1524229514.84.0.682650639539.issue33319@psf.upfronthosting.co.za>
In-reply-to
Content
I'm porting old scripts from Python 2.7 to 3.6 and plan to change `subprocess.call()` to `subprocess.run()` at the same time. When using `call()` I've used `tempfile.TemporaryFile` as stdout because it's documentation has this warning:

    Note: Do not use stdout=PIPE or stderr=PIPE with this function. The child process will block if it generates enough output to a pipe to fill up the OS pipe buffer as the pipes are not being read from.

Interestingly there is no such note in the docs of `run()`, and based on my (possibly inadequate) testing I couldn't get it to hang either. I'm still somewhat worried about using `stdout=PIPE` with it because the docs don't explicitly say it would be safe. I'm especially worried because the docs of `call()` nowadays say that it's equivalent to `run(...).returncode`. If that's the case, then I would expect the warning in `call()` to apply also to `run()`. Or is the warning nowadays outdated altogether?
History
Date User Action Args
2018-04-20 13:05:14pekka.klarcksetrecipients: + pekka.klarck
2018-04-20 13:05:14pekka.klarcksetmessageid: <1524229514.84.0.682650639539.issue33319@psf.upfronthosting.co.za>
2018-04-20 13:05:14pekka.klarcklinkissue33319 messages
2018-04-20 13:05:14pekka.klarckcreate