Message148311
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)) |
|
Date |
User |
Action |
Args |
2011-11-25 09:02:43 | kxroberto | set | recipients:
+ kxroberto |
2011-11-25 09:02:43 | kxroberto | set | messageid: <1322211763.06.0.781568755806.issue13479@psf.upfronthosting.co.za> |
2011-11-25 09:02:42 | kxroberto | link | issue13479 messages |
2011-11-25 09:02:41 | kxroberto | create | |
|