# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1606898949 -19800 # Node ID 7e1b4154cdca2381648790f8f03b965dbfa7e933 # Parent 81c1f5d1801f39fd29bcc920371032a92b8171d7 dispatch: disable line ending normalization on sys.stdin if its None Fixes test-chg.t on python 3 with chg. Differential Revision: https://phab.mercurial-scm.org/D9501 diff -r 81c1f5d1801f -r 7e1b4154cdca mercurial/dispatch.py --- a/mercurial/dispatch.py Wed Dec 02 13:55:17 2020 +0530 +++ b/mercurial/dispatch.py Wed Dec 02 14:19:09 2020 +0530 @@ -187,15 +187,16 @@ sys.stderr.buffer, sys.stderr.encoding, sys.stderr.errors, **kwargs ) - # No write_through on read-only stream. - sys.stdin = io.TextIOWrapper( - sys.stdin.buffer, - sys.stdin.encoding, - sys.stdin.errors, - # None is universal newlines mode. - newline=None, - line_buffering=sys.stdin.line_buffering, - ) + if sys.stdin is not None: + # No write_through on read-only stream. + sys.stdin = io.TextIOWrapper( + sys.stdin.buffer, + sys.stdin.encoding, + sys.stdin.errors, + # None is universal newlines mode. + newline=None, + line_buffering=sys.stdin.line_buffering, + ) def _silencestdio(): for fp in (sys.stdout, sys.stderr):