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 kxroberto
Recipients kxroberto
Date 2011-11-25.09:02:41
SpamBayes Score 0.00030608795
Marked as misclassified No
Message-id <1322211763.06.0.781568755806.issue13479@psf.upfronthosting.co.za>
In-reply-to
Content
When a class definition was re-executed (reload, exec ..) , pickling of existing instances fails for to picky reason (class object id mismatch). Solved by the one liner patch below.

Rational: Python is dynamic. Like with any normal attribute lookup: When its the same module/..name  this class is really meant - no matter about its id. 
(During unpickling its another id anyway, the code may have evolved years ...)


diff -ur --strip _orig/pickle.py ./pickle.py
--- _orig/pickle.py	2008-09-08 10:58:32 +0000
+++ ./pickle.py	2011-11-24 15:47:11 +0000
@@ -747,7 +747,7 @@
                 "Can't pickle %r: it's not found as %s.%s" %
                 (obj, module, name))
         else:
-            if klass is not obj:
+            if klass.__name__ != obj.__name__:
                 raise PicklingError(
                     "Can't pickle %r: it's not the same object as %s.%s" %
                     (obj, module, name))
History
Date User Action Args
2011-11-25 09:02:43kxrobertosetrecipients: + kxroberto
2011-11-25 09:02:43kxrobertosetmessageid: <1322211763.06.0.781568755806.issue13479@psf.upfronthosting.co.za>
2011-11-25 09:02:42kxrobertolinkissue13479 messages
2011-11-25 09:02:41kxrobertocreate