Mercurial > hg-stable
changeset 36665:c263c684da91
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.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 02 Mar 2018 22:10:36 -0500 |
parents | e80f8a134731 |
children | e8c361316803 |
files | mercurial/dispatch.py |
diffstat | 1 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dispatch.py Thu Mar 01 18:25:19 2018 -0500 +++ b/mercurial/dispatch.py Fri Mar 02 22:10:36 2018 -0500 @@ -105,12 +105,15 @@ # 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()