# HG changeset patch # User Yuya Nishihara # Date 2018-03-03 03:10:36 # Node ID c263c684da914e4612190def8e459cd6e5a4bd26 # Parent e80f8a134731955367b8780e9bc48846973e39b9 py3: conditionalize initialization of stdio flags Since Python 3 doesn't depend on the stdio of libc, there should be no need to set O_BINARY flag on Windows. diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -105,12 +105,15 @@ def run(): # change the status code and move on. except IOError: status = -1 - sys.exit(status & 255) -def _initstdio(): - for fp in (sys.stdin, sys.stdout, sys.stderr): - util.setbinary(fp) +if pycompat.ispy3: + def _initstdio(): + pass +else: + def _initstdio(): + for fp in (sys.stdin, sys.stdout, sys.stderr): + util.setbinary(fp) def _getsimilar(symbols, value): sim = lambda x: difflib.SequenceMatcher(None, value, x).ratio()