comparison mercurial/dispatch.py @ 50564:2452843baf90

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:31 +0100
parents 309a7ecef246
children fca08dd6223d
comparison
equal deleted inserted replaced
50563:309a7ecef246 50564:2452843baf90
114 ui.fout.flush() 114 ui.fout.flush()
115 except IOError as e: 115 except IOError as e:
116 err = e 116 err = e
117 status = -1 117 status = -1
118 118
119 if util.safehasattr(ui, b'ferr'): 119 if util.safehasattr(ui, 'ferr'):
120 assert ui is not None # help pytype 120 assert ui is not None # help pytype
121 assert ui.ferr is not None # help pytype 121 assert ui.ferr is not None # help pytype
122 try: 122 try:
123 if err is not None and err.errno != errno.EPIPE: 123 if err is not None and err.errno != errno.EPIPE:
124 ui.ferr.write( 124 ui.ferr.write(