Mercurial > hg-stable
changeset 14959:b1dcc5ab86cd
lsprof: use getattr instead of hasattr
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Mon, 25 Jul 2011 15:41:46 -0500 |
parents | fd246aefedd3 |
children | 497819817307 |
files | mercurial/lsprof.py |
diffstat | 1 files changed, 1 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/lsprof.py Mon Jul 25 20:36:59 2011 -0500 +++ b/mercurial/lsprof.py Mon Jul 25 15:41:46 2011 -0500 @@ -86,9 +86,7 @@ for k, v in list(sys.modules.iteritems()): if v is None: continue - if not hasattr(v, '__file__'): - continue - if not isinstance(v.__file__, str): + if not isinstance(getattr(v, '__file__', None), str): continue if v.__file__.startswith(code.co_filename): mname = _fn2mod[code.co_filename] = k