mirror of
https://github.com/facebook/sapling.git
synced 2024-10-08 07:49:11 +03:00
hg: explain why util.safehasattr should be used
Reviewed By: quark-zju Differential Revision: D7100678 fbshipit-source-id: f5a1033a53a0beec23f938d2eea592b50b13c9a5
This commit is contained in:
parent
42ac84e8cf
commit
9eb001d7e0
@ -183,6 +183,8 @@ _notset = object()
|
||||
os.stat_float_times(False)
|
||||
|
||||
def safehasattr(thing, attr):
|
||||
# Use instead of the builtin ``hasattr``. (See
|
||||
# https://hynek.me/articles/hasattr/)
|
||||
return getattr(thing, attr, _notset) is not _notset
|
||||
|
||||
def bytesinput(fin, fout, *args, **kwargs):
|
||||
|
Loading…
Reference in New Issue
Block a user