comparison mercurial/localrepo.py @ 50582:2d9ba65a4d0a

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:28:40 +0100
parents b2ec43d552d4
children 58e58ea3dcb8
comparison
equal deleted inserted replaced
50581:b2ec43d552d4 50582:2d9ba65a4d0a
1516 def checkvfs(path, mode=None): 1516 def checkvfs(path, mode=None):
1517 ret = origfunc(path, mode=mode) 1517 ret = origfunc(path, mode=mode)
1518 repo = rref() 1518 repo = rref()
1519 if ( 1519 if (
1520 repo is None 1520 repo is None
1521 or not util.safehasattr(repo, b'_wlockref') 1521 or not util.safehasattr(repo, '_wlockref')
1522 or not util.safehasattr(repo, b'_lockref') 1522 or not util.safehasattr(repo, '_lockref')
1523 ): 1523 ):
1524 return 1524 return
1525 if mode in (None, b'r', b'rb'): 1525 if mode in (None, b'r', b'rb'):
1526 return 1526 return
1527 if path.startswith(repo.path): 1527 if path.startswith(repo.path):