Patchwork [1,of,5,RESEND] windows: do not replace sys.__stdout__

login
register
mail settings
Submitter Yuya Nishihara
Date Nov. 11, 2016, 3:50 p.m.
Message ID <ea1fe2ae9003fa458889.1478879420@mimosa>
Download mbox | patch
Permalink /patch/17499/
State Accepted
Headers show

Comments

Yuya Nishihara - Nov. 11, 2016, 3:50 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1476973629 -32400
#      Thu Oct 20 23:27:09 2016 +0900
# Node ID ea1fe2ae9003fa4588897545bbc89f1de17e3fa7
# Parent  e193870eb680985042a41a6ba6e4a42b18b49bda
windows: do not replace sys.__stdout__

Now we don't use sys.__stdout__ except for getting its fileno(), so we no
longer have to wrap it by winstdout.

This helps adding pycompat.stdin/out/err.

Patch

diff --git a/mercurial/windows.py b/mercurial/windows.py
--- a/mercurial/windows.py
+++ b/mercurial/windows.py
@@ -171,7 +171,7 @@  class winstdout(object):
             self.close()
             raise IOError(errno.EPIPE, 'Broken pipe')
 
-sys.__stdout__ = sys.stdout = winstdout(sys.stdout)
+sys.stdout = winstdout(sys.stdout)
 
 def _is_win_9x():
     '''return true if run on windows 95, 98 or me.'''