From d0075e7e502ed05c5bbcb5b5675bf5f492ea3c44 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sun, 27 Jan 2019 01:14:27 +0000 Subject: [PATCH] parent: --with-pydebug bootstrap could fail due to corrupted stream Due to first stage writin 'XXX refs' on exit. So close stderr as last step of first stage. --- mitogen/parent.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mitogen/parent.py b/mitogen/parent.py index 97917cae..a81ca9dd 100644 --- a/mitogen/parent.py +++ b/mitogen/parent.py @@ -1181,6 +1181,9 @@ class Stream(mitogen.core.Stream): # r: read side of core_src FD. # w: write side of core_src FD. # C: the decompressed core source. + + # Final os.close(2) to avoid --py-debug build from corrupting stream with + # "[1234 refs]" during exit. @staticmethod def _first_stage(): R,W=os.pipe() @@ -1206,6 +1209,7 @@ class Stream(mitogen.core.Stream): fp.write(C) fp.close() os.write(1,'MITO001\n'.encode()) + os.close(2) def get_python_argv(self): """