On 2020-07-17 13:24, Yuya Nishihara wrote:
On Fri, 17 Jul 2020 04:38:50 +0200, Manuel Jacob wrote:
# HG changeset patch
# User Manuel Jacob <m...@manueljacob.de>
# Date 1594949332 -7200
#      Fri Jul 17 03:28:52 2020 +0200
# Node ID 741837f160677ec24154b3d5aa209133a3872d53
# Parent  91f6d0508acac2c8eb0fbf8864528f8f584e697c
# EXP-Topic stdio-broken_pipe
windows: always work around EINVAL in case of broken pipe for stdout / stderr

Queued, thanks.

diff --git a/mercurial/windows.py b/mercurial/windows.py
--- a/mercurial/windows.py
+++ b/mercurial/windows.py
@@ -197,6 +197,7 @@

     def __init__(self, fp):
         self.fp = fp
+        self.throttle = not pycompat.ispy3 and fp.isatty()

If we need to handle the case where sys.stdout is a pseudo file object on
Python 2, isatty() may be missing.

Right, I’ll send another patch. Feel free to fold them together.

     def write(self, s):
+        if not pycompat.ispy3:
+            self.softspace = 0

No idea what this softspace is for, but I assume it's py2-only attribute.

It’s an obscure implementation artifact of the Python 2 print function: https://docs.python.org/2/library/stdtypes.html#file.softspace

I tried to not change the behavior of the existing code on Python 2. However, reading from the documentation, it is likely that removing that code makes it more correct that leaving it. Also, I think we don’t use the Python 2 print function ourselves. Should we remove the two lines?
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to