py3: add warning about buffering behavior of pycompat.{stdout,stderr} stable
authorManuel Jacob <me@manueljacob.de>
Fri, 05 Jun 2020 07:20:52 +0200
branchstable
changeset 44918 7be784f301fa
parent 44917 bad37041fc1e
child 44919 065704cbdbdb
py3: add warning about buffering behavior of pycompat.{stdout,stderr}
mercurial/pycompat.py
--- a/mercurial/pycompat.py	Fri Jun 05 04:10:37 2020 +0200
+++ b/mercurial/pycompat.py	Fri Jun 05 07:20:52 2020 +0200
@@ -143,6 +143,11 @@
 
     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