[PATCH 1 of 4 stable] py3: add warning about buffering behavior of pycompat.{stdout,stderr}

Manuel Jacob me at manueljacob.de
Fri Jun 5 09:44:48 UTC 2020


# HG changeset patch
# User Manuel Jacob <me at manueljacob.de>
# Date 1591334452 -7200
#      Fri Jun 05 07:20:52 2020 +0200
# Branch stable
# Node ID ab1bb054809d078f7111c5145c1a4e2c536d37c5
# Parent  2dc5ae953c4a8265578acbe7d3e26c93ec8a08fb
# EXP-Topic streams
py3: add warning about buffering behavior of pycompat.{stdout,stderr}

diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py
--- a/mercurial/pycompat.py
+++ b/mercurial/pycompat.py
@@ -143,6 +143,11 @@ if ispy3:
 
     long = int
 
+    # Warning: sys.stdout.buffer and sys.stderr.buffer do not necessarily have
+    # the same buffering behavior as sys.stdout and sys.stderr. The interpreter
+    # 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.
     # 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



More information about the Mercurial-devel mailing list