[issue3675] Python 2.6 can't read sets pickled with Python 3.0

Daniel Diniz report at bugs.python.org
Thu Aug 28 18:42:00 CEST 2008


Daniel Diniz <ajaksu at gmail.com> added the comment:

Hagen,
does this simple patch (against 2.6) solve it for you?

Index: Lib/pickle.py
===================================================================
--- Lib/pickle.py       (revision 66050)
+++ Lib/pickle.py       (working copy)
@@ -1121,6 +1121,8 @@

     def find_class(self, module, name):
         # Subclasses may override this
+        if module == "builtins":
+            module = "__builtin__"
         __import__(module)
         mod = sys.modules[module]
         klass = getattr(mod, name)

I think a dict mapping the moved modules would work better, perhaps
having it in PyPI would be enough?

----------
nosy: +ajaksu2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3675>
_______________________________________


More information about the Python-bugs-list mailing list