mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Replace hasattr() + getattr() with single getattr() and default value.
This commit is contained in:
parent
26507dbc82
commit
656d4519b5
1 changed files with 1 additions and 2 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue