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

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

Comments

Manuel Jacob - June 5, 2020, 9:44 a.m.
# HG changeset patch
# User Manuel Jacob <me@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}
Yuya Nishihara - June 5, 2020, 11:39 a.m.
On Fri, 05 Jun 2020 11:44:48 +0200, Manuel Jacob wrote:
> # HG changeset patch
> # User Manuel Jacob <me@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}

Queued 1 and 3 for stable, thanks.

Patch

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