Help with PicklingError (Can't pickle x: it's not the same object as x)

Tracy Ruggles tracy at
Tue Feb 10 16:42:09 CET 2004

>>> sys.platform, sys.version
('freebsd4', '2.2.3 (#2, Nov 17 2003, 17:03:14) \n[GCC 2.95.3 20010315
(release) [FreeBSD]]')

I've poured through (line 525) and see where the
PicklingError is being raised, but I can't figure out what conditions
would create the error.

It's testing a class' identity with the object's class that's being
pickled.  Somewhere along the line, the original class and the class
of the instance being pickled have parted ways.

Could this have been caused by a reload(module) call somewhere along
the line?  I thought that reload would only replace the module in
sys.modules if the file had changed since the original
import.  I'm pretty certain that the object's class is not being
altered between the time its module was imported and the time of the
pickling attempt.

Note: the object being pickled is a subclass of 'dict'.  I'm creating
a test case where my class is just a subclass of 'object' to see if
the error is related to that...


More information about the Python-list mailing list