hg: explain why util.safehasattr should be used

Reviewed By: quark-zju

Differential Revision: D7100678

fbshipit-source-id: f5a1033a53a0beec23f938d2eea592b50b13c9a5
This commit is contained in:
Phil Cohen 2018-02-27 11:32:58 -08:00 committed by Saurabh Singh
parent 42ac84e8cf
commit 9eb001d7e0

View File

@ -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):