changeset 48902:1ba11c8f3430

chgserver: remove Python 2 branch Differential Revision: https://phab.mercurial-scm.org/D12305
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 21 Feb 2022 10:40:58 -0700
parents cc0e059d2af8
children 0bb28b7736bc
files mercurial/chgserver.py
diffstat 1 files changed, 1 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/chgserver.py	Mon Feb 21 10:39:48 2022 -0700
+++ b/mercurial/chgserver.py	Mon Feb 21 10:40:58 2022 -0700
@@ -408,22 +408,13 @@
             # be unbuffered no matter if it is a tty or not.
             if fn == b'ferr':
                 newfp = fp
-            elif pycompat.ispy3:
+            else:
                 # On Python 3, the standard library doesn't offer line-buffered
                 # binary streams, so wrap/unwrap it.
                 if fp.isatty():
                     newfp = procutil.make_line_buffered(fp)
                 else:
                     newfp = procutil.unwrap_line_buffered(fp)
-            else:
-                # Python 2 uses the I/O streams provided by the C library, so
-                # make it line-buffered explicitly. Otherwise the default would
-                # be decided on first write(), where fout could be a pager.
-                if fp.isatty():
-                    bufsize = 1  # line buffered
-                else:
-                    bufsize = -1  # system default
-                newfp = os.fdopen(fp.fileno(), mode, bufsize)
             if newfp is not fp:
                 setattr(ui, fn, newfp)
             setattr(self, cn, newfp)