procutil: explain better why line buffering is not possible
authorManuel Jacob <me@manueljacob.de>
Fri, 10 Jul 2020 09:55:38 +0200
changeset 45079 8628cd1122d2
parent 45078 a59aab6078eb
child 45080 00cdac669614
procutil: explain better why line buffering is not possible The sentence “On Python 3, buffered binary streams can't be set line-buffered.” was imprecise, as all streams are just Python classes and we can implement our own (which we did).
mercurial/utils/procutil.py
--- a/mercurial/utils/procutil.py	Tue Jul 07 12:13:40 2020 +0200
+++ b/mercurial/utils/procutil.py	Fri Jul 10 09:55:38 2020 +0200
@@ -99,9 +99,10 @@
 # buffering.
 if isatty(stdout):
     if pycompat.ispy3 or pycompat.iswindows:
-        # On Python 3, buffered binary streams can't be set line-buffered.
-        # On Python 2, Windows doesn't support line buffering.
-        # Therefore we have a wrapper that implements line buffering.
+        # Python 3 implements its own I/O streams.
+        # The standard library doesn't offer line-buffered binary streams.
+        # Python 2 uses the I/O streams provided by the C library.
+        # The Windows C runtime library doesn't support line buffering.
         stdout = make_line_buffered(stdout)
     else:
         stdout = os.fdopen(stdout.fileno(), 'wb', 1)