chgserver: remove Python 2 branch
authorGregory Szorc <gregory.szorc@gmail.com>
Mon, 21 Feb 2022 10:40:58 -0700
changeset 48902 1ba11c8f3430
parent 48901 cc0e059d2af8
child 48903 0bb28b7736bc
chgserver: remove Python 2 branch Differential Revision: https://phab.mercurial-scm.org/D12305
mercurial/chgserver.py
--- 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)