From: Jeremy Hylton Date: Thu, 6 Feb 2003 16:22:01 +0000 (+0000) Subject: Replace hasattr() + getattr() with single getattr() and default value. X-Git-Tag: v2.3c1~2002 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=656d4519b5a002d716ae2081d126a060fcb12581;p=thirdparty%2FPython%2Fcpython.git Replace hasattr() + getattr() with single getattr() and default value. --- diff --git a/Lib/pickle.py b/Lib/pickle.py index 35ab91b91436..876c81b70a1e 100644 --- a/Lib/pickle.py +++ b/Lib/pickle.py @@ -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__'