mirror of https://github.com/python/cpython
Replace hasattr() + getattr() with single getattr() and default value.
This commit is contained in:
parent
26507dbc82
commit
656d4519b5
|
@ -943,8 +943,7 @@ def whichmodule(func, funcname):
|
|||
if module is None:
|
||||
continue # skip dummy package entries
|
||||
if name != '__main__' and \
|
||||
hasattr(module, funcname) and \
|
||||
getattr(module, funcname) is func:
|
||||
getattr(module, funcname, None) is func:
|
||||
break
|
||||
else:
|
||||
name = '__main__'
|
||||
|
|
Loading…
Reference in New Issue