[Python-checkins] python/dist/src/Lib pickle.py,1.69,1.70

jhylton@users.sourceforge.net jhylton@users.sourceforge.net
Thu, 19 Sep 2002 15:57:28 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv28780

Modified Files:
	pickle.py 
Log Message:
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.


Index: pickle.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/pickle.py,v
retrieving revision 1.69
retrieving revision 1.70
diff -C2 -d -r1.69 -r1.70
*** pickle.py	14 Aug 2002 07:46:22 -0000	1.69
--- pickle.py	19 Sep 2002 22:57:26 -0000	1.70
***************
*** 627,630 ****
--- 627,632 ----
  
      for name, module in sys.modules.items():
+         if module is None: 
+             continue # skip dummy package entries
          if name != '__main__' and \
              hasattr(module, clsname) and \