diff options
author | Antoine Pitrou <pitrou@free.fr> | 2017-10-22 09:40:31 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-22 09:40:31 (GMT) |
commit | daeefd2e049b74340307481112a39f77de0f4769 (patch) | |
tree | 7b55a2b183b67fef2f41257d2a87b3f2e87ee02e /Lib/multiprocessing | |
parent | 73c4708630f99b94c35476529748629fff1fc63e (diff) | |
download | cpython-daeefd2e049b74340307481112a39f77de0f4769.zip cpython-daeefd2e049b74340307481112a39f77de0f4769.tar.gz cpython-daeefd2e049b74340307481112a39f77de0f4769.tar.bz2 |
bpo-28326: Fix multiprocessing.Process when stdout and/or stderr is closed or None. (#4073)
Diffstat (limited to 'Lib/multiprocessing')
-rw-r--r-- | Lib/multiprocessing/popen_fork.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/multiprocessing/popen_fork.py b/Lib/multiprocessing/popen_fork.py index cbdbfa7..b0fc013 100644 --- a/Lib/multiprocessing/popen_fork.py +++ b/Lib/multiprocessing/popen_fork.py @@ -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) |