Patchwork ui: replace `self._ferr` with identical `dest`

login
register
mail settings
Submitter Manuel Jacob
Date June 22, 2020, 12:10 a.m.
Message ID <1cb5db2ebec29368a783.1592784626@tmp>
Download mbox | patch
Permalink /patch/46542/
State Accepted
Headers show

Comments

Manuel Jacob - June 22, 2020, 12:10 a.m.
# HG changeset patch
# User Manuel Jacob <me@manueljacob.de>
# Date 1591245840 -7200
#      Thu Jun 04 06:44:00 2020 +0200
# Node ID 1cb5db2ebec29368a7830092686e6afc1ca822b9
# Parent  a46e36b824612be16b38a1c1cd11160c293d115b
# EXP-Topic ui_stream_buffering
ui: replace `self._ferr` with identical `dest`

Originally, it was part of a larger change that was abandoned. IMHO it makes the
code slightly cleaner and saves one attribute access, so I decided to send it
anyway instead of throwing it away.
Yuya Nishihara - June 22, 2020, 10:48 a.m.
On Mon, 22 Jun 2020 02:10:26 +0200, Manuel Jacob wrote:
> # HG changeset patch
> # User Manuel Jacob <me@manueljacob.de>
> # Date 1591245840 -7200
> #      Thu Jun 04 06:44:00 2020 +0200
> # Node ID 1cb5db2ebec29368a7830092686e6afc1ca822b9
> # Parent  a46e36b824612be16b38a1c1cd11160c293d115b
> # EXP-Topic ui_stream_buffering
> ui: replace `self._ferr` with identical `dest`

Queued, thanks.

Patch

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1200,7 +1200,7 @@ 
                 dest.write(msg)
             # stderr may be buffered under win32 when redirected to files,
             # including stdout.
-            if dest is self._ferr and not getattr(self._ferr, 'closed', False):
+            if dest is self._ferr and not getattr(dest, 'closed', False):
                 dest.flush()
         except IOError as err:
             if dest is self._ferr and err.errno in (