Mercurial > public > mercurial-scm > hg
comparison mercurial/mdiff.py @ 50586:362d5a2ffd17
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:32:38 +0100 |
parents | a78dfb1ad60e |
children | e586a7eb380a |
comparison
equal
deleted
inserted
replaced
50585:0ec94359eae8 | 50586:362d5a2ffd17 |
---|---|
211 | 211 |
212 def chooseblocksfunc(opts=None): | 212 def chooseblocksfunc(opts=None): |
213 if ( | 213 if ( |
214 opts is None | 214 opts is None |
215 or not opts.xdiff | 215 or not opts.xdiff |
216 or not util.safehasattr(bdiff, b'xdiffblocks') | 216 or not util.safehasattr(bdiff, 'xdiffblocks') |
217 ): | 217 ): |
218 return bdiff.blocks | 218 return bdiff.blocks |
219 else: | 219 else: |
220 return bdiff.xdiffblocks | 220 return bdiff.xdiffblocks |
221 | 221 |