aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Pitrou <pitrou@free.fr>2018-03-11 19:21:38 +0100
committerGitHub <noreply@github.com>2018-03-11 19:21:38 +0100
commite756f66c83786ee82f5f7d45931ae50a6931dd7f (patch)
treef3d6b9bd7d6319fc3149841bb7498e326d9fe7c9 /Lib/multiprocessing/popen_fork.py
parentDrop confusing commented out code in pystrtod.c (GH-6072) (diff)
downloadcpython-e756f66c83786ee82f5f7d45931ae50a6931dd7f.tar.gz
cpython-e756f66c83786ee82f5f7d45931ae50a6931dd7f.tar.bz2
cpython-e756f66c83786ee82f5f7d45931ae50a6931dd7f.zip
bpo-31804: Fix multiprocessing.Process with broken standard streams (#6079)
In some conditions the standard streams will be None or closed in the child process (for example if using "pythonw" instead of "python" on Windows). Avoid failing with a non-0 exit code in those conditions. Report and initial patch by poxthegreat.
Diffstat (limited to 'Lib/multiprocessing/popen_fork.py')
-rw-r--r--Lib/multiprocessing/popen_fork.py9
1 files changed, 1 insertions, 8 deletions
diff --git a/Lib/multiprocessing/popen_fork.py b/Lib/multiprocessing/popen_fork.py
index b0fc01396eb..008b97b3662 100644
--- a/Lib/multiprocessing/popen_fork.py
+++ b/Lib/multiprocessing/popen_fork.py
@@ -14,14 +14,7 @@ class Popen(object):
method = 'fork'
def __init__(self, process_obj):
- try:
- sys.stdout.flush()
- except (AttributeError, ValueError):
- pass
- try:
- sys.stderr.flush()
- except (AttributeError, ValueError):
- pass
+ util._flush_std_streams()
self.returncode = None
self.finalizer = None
self._launch(process_obj)