This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gpk
Recipients georg.brandl, gpk
Date 2008-03-15.19:18:43
SpamBayes Score 0.199946
Marked as misclassified No
Message-id <>
If you attempt to cPickle a class, cPickle checks
that it can get the identical class by importing it.

If that check fails, it reports:
Traceback (most recent call last):
line 41, in send
    s = cPickle.dumps( args, cPickle.HIGHEST_PROTOCOL)
cPickle.PicklingError: Can't pickle <class 'test_simple2.aModel'>: it's
not the same object as test_simple2.aModel

Normally, this is probably a good thing.   However, if you do
an import using the "imp" module, via
 imp.load_module(name, fd, pn, desc), you get the "same" module
containing the "same" classes, but everything is duplicated at
different addresses.  In other words, you get distinct class
objects from what cPickle
will find.   Consequently, the when cPickle makes the
"is" comparison between what you gave it and what it can find,
it will fail and cause an error.

In this case, the error is wrong. I know that the aModel classes
come from the same file and are member-for-member the same.

This may well be a documentation
error:  it needs to mention this test and note that classes in modules
via imp are not picklable.    Or, imp needs to note that its results
are not picklable.   Or both.

Or, maybe it's something that should be fixed, though I'm not
sure if there is a general solution that will always behave
Date User Action Args
2008-03-15 19:18:47gpksetspambayes_score: 0.199946 -> 0.199946
recipients: + gpk, georg.brandl
2008-03-15 19:18:46gpksetspambayes_score: 0.199946 -> 0.199946
messageid: <>
2008-03-15 19:18:44gpklinkissue2295 messages
2008-03-15 19:18:43gpkcreate