bpo-28326: Fix multiprocessing.Process when stdout and/or stderr is closed or None. (#4073)

This commit is contained in:
Antoine Pitrou 2017-10-22 11:40:31 +02:00 committed by GitHub
parent 73c4708630
commit daeefd2e04
3 changed files with 30 additions and 2 deletions

View file

@ -14,8 +14,14 @@ class Popen(object):
method = 'fork'
def __init__(self, process_obj):
sys.stdout.flush()
sys.stderr.flush()
try:
sys.stdout.flush()
except (AttributeError, ValueError):
pass
try:
sys.stderr.flush()
except (AttributeError, ValueError):
pass
self.returncode = None
self.finalizer = None
self._launch(process_obj)