summaryrefslogtreecommitdiffstats
path: root/Lib/pickle.py
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2002-09-19 22:57:26 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2002-09-19 22:57:26 (GMT)
commit065a5ab8fb89b6f082a8361b860b48c00f21c301 (patch)
tree55bfa8724eb1d8e40e54d5246a4b8f3a126b93e1 /Lib/pickle.py
parent16849a7e5308dc07f14847d1691a533fe26d729a (diff)
downloadcpython-065a5ab8fb89b6f082a8361b860b48c00f21c301.zip
cpython-065a5ab8fb89b6f082a8361b860b48c00f21c301.tar.gz
cpython-065a5ab8fb89b6f082a8361b860b48c00f21c301.tar.bz2
whichmodule() should skip dummy package entries in sys.modules.
This fixes the charming, but unhelpful error message for >>> pickle.dumps(type.__new__) Can't pickle <built-in method __new__ of type object at 0x812a440>: it's not the same object as datetime.math.__new__ Bugfix candidate.
Diffstat (limited to 'Lib/pickle.py')
-rw-r--r--Lib/pickle.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/pickle.py b/Lib/pickle.py
index 4bc54ec..d4085cf 100644
--- a/Lib/pickle.py
+++ b/Lib/pickle.py
@@ -626,6 +626,8 @@ def whichmodule(cls, clsname):
return classmap[cls]
for name, module in sys.modules.items():
+ if module is None:
+ continue # skip dummy package entries
if name != '__main__' and \
hasattr(module, clsname) and \
getattr(module, clsname) is cls: