Patchwork [2,of,4,stable] py3: schedule pycompat.{stdin,stdout,stderr} for removal

login
register
mail settings
Submitter Manuel Jacob
Date June 5, 2020, 9:44 a.m.
Message ID <31ab0d15f82bfef3030b.1591350289@tmp>
Download mbox | patch
Permalink /patch/46466/
State Accepted
Headers show

Comments

Manuel Jacob - June 5, 2020, 9:44 a.m.
# HG changeset patch
# User Manuel Jacob <me@manueljacob.de>
# Date 1591334577 -7200
#      Fri Jun 05 07:22:57 2020 +0200
# Branch stable
# Node ID 31ab0d15f82bfef3030b653583f89c0d0449fd9c
# Parent  ab1bb054809d078f7111c5145c1a4e2c536d37c5
# EXP-Topic streams
py3: schedule pycompat.{stdin,stdout,stderr} for removal

Patch

diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py
--- a/mercurial/pycompat.py
+++ b/mercurial/pycompat.py
@@ -148,6 +148,12 @@  if ispy3:
     # initializes them with block-buffered streams or unbuffered streams (when
     # the -u option or the PYTHONUNBUFFERED environment variable is set), never
     # with a line-buffered stream.
+    # FIXME: Because that makes them only superficially a replacement for
+    # Python 2's standard streams and could mislead people into thinking they
+    # are replacements that behave consistently across Python versions, they
+    # should be removed after Mercurial 5.4. Instead, users should use
+    # procutil.{stdin,stdout,stderr}, which aims to provide a sufficiently
+    # consistent behavior across platforms and Python versions.
     # TODO: .buffer might not exist if std streams were replaced; we'll need
     # a silly wrapper to make a bytes stream backed by a unicode one.
     stdin = sys.stdin.buffer