comparison mercurial/dispatch.py @ 50566:309a7ecef246

safehasattr: pass attribute name as string instead of bytes This is a step toward replacing `util.safehasattr` usage with plain `hasattr`. The builtin function behave poorly in Python2 but this was fixed in Python3. These change are done one by one as they tend to have a small odd to trigger puzzling breackage.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 02 Feb 2023 17:23:20 +0100
parents afb27fc92717
children 2452843baf90
comparison
equal deleted inserted replaced
50565:2b1cd454793a 50566:309a7ecef246
105 105
106 106
107 def _flushstdio(ui, err): 107 def _flushstdio(ui, err):
108 status = None 108 status = None
109 # In all cases we try to flush stdio streams. 109 # In all cases we try to flush stdio streams.
110 if util.safehasattr(ui, b'fout'): 110 if util.safehasattr(ui, 'fout'):
111 assert ui is not None # help pytype 111 assert ui is not None # help pytype
112 assert ui.fout is not None # help pytype 112 assert ui.fout is not None # help pytype
113 try: 113 try:
114 ui.fout.flush() 114 ui.fout.flush()
115 except IOError as e: 115 except IOError as e: