[issue3675] Python 2.6 can't read sets pickled with Python 3.0
Alexandre Vassalotti alexan...@peadrop.com added the comment: Superseded by issue #6137. -- resolution: - duplicate status: open - closed superseder: - Make pickle generated by Python 3.x compatible with 2.x and vice-versa. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3675 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3675] Python 2.6 can't read sets pickled with Python 3.0
Alexandre Vassalotti alexan...@peadrop.com added the comment: Would it would be sufficient to add a function in the pickletools capable of converting old Python 2 pickles to the new format in Python 3? Alternatively, we could add a compatibility Unpickler class that would override the find_class method to do the name translation on-the-fly. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3675 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3675] Python 2.6 can't read sets pickled with Python 3.0
Changes by Collin Winter coll...@gmail.com: -- nosy: +collinwinter ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3675 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3675] Python 2.6 can't read sets pickled with Python 3.0
Changes by Antoine Pitrou pit...@free.fr: -- versions: +Python 2.7, Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3675 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3675] Python 2.6 can't read sets pickled with Python 3.0
Alexandre Vassalotti [EMAIL PROTECTED] added the comment: I agree with Antoine, protocols = 2 should remain compatible with Python 2.x or be deprecated. Keeping compatibility will require a hack, in addition to the proposed patch, in Pickler.save_global to map Python 3's module names to the ones of Python 2. ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3675 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3675] Python 2.6 can't read sets pickled with Python 3.0
Terry J. Reedy [EMAIL PROTECTED] added the comment: Was it really intended that 3.0 pickles unpickle on 2.6? What about other changes like moving something from one module to another (reduce from built-in to functools), changing all classes to new style (several examples), or adding methods to a built-in class (floats)? -- nosy: +tjreedy ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3675 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3675] Python 2.6 can't read sets pickled with Python 3.0
Antoine Pitrou [EMAIL PROTECTED] added the comment: Was it really intended that 3.0 pickles unpickle on 2.6? He used protocol 2, so he explicitly asked for something inpickleable with 2.6. If it's not the intended behaviour, then protocols 3 should be deprecated. -- nosy: +pitrou ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3675 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3675] Python 2.6 can't read sets pickled with Python 3.0
Daniel Diniz [EMAIL PROTECTED] 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 [EMAIL PROTECTED] http://bugs.python.org/issue3675 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3675] Python 2.6 can't read sets pickled with Python 3.0
Hagen Fürstenau [EMAIL PROTECTED] added the comment: Well, Python = 2.5 still wouldn't be able to unpickle those built in objects. ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3675 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3675] Python 2.6 can't read sets pickled with Python 3.0
Daniel Diniz [EMAIL PROTECTED] added the comment: FWIW, there's a mapping of 2.6:3.0 modules in lib2to3: from lib2to3.fixes.fix_imports import MAPPING The attached patch uses that for a quick and dirty way of loading 3.0 pickles in 2.6. -- keywords: +patch Added file: http://bugs.python.org/file11293/pickle.diff ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3675 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3675] Python 2.6 can't read sets pickled with Python 3.0
Hagen Fürstenau [EMAIL PROTECTED] added the comment: Well, this is obviously caused by renaming __builtin__ to builtins and the fact that set (as well as frozenset) doesn't have its own opcode and therefore gets looked up in builtins. The problem therefore extends to all builtin objects without opcode special casing (e.g. object, slice, property, ...) I'm afraid that means we have to pickle builtins as __builtin__ for backwards compatibility in protocols = 2. But aside from that, wouldn't it be more consistent to have opcodes for set/frozenset in protocol 3? ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3675 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3675] Python 2.6 can't read sets pickled with Python 3.0
New submission from Hagen Fürstenau [EMAIL PROTECTED]: After pickling a set of ints with Python 3.0 and pickle protocol 2: [EMAIL PROTECTED] ~]$ python3.0 Python 3.0b3 (r30b3:65927, Aug 21 2008, 11:48:29) [GCC 4.1.0 20060304 (Red Hat 4.1.0-3)] on linux2 Type help, copyright, credits or license for more information. import pickle f = open(test, wb) pickle.dump({1,2,3}, f, 2) f.close() I get the following error when trying to read this with Python 2.6: [EMAIL PROTECTED] ~]$ python Python 2.6b3 (r26b3:65922, Aug 21 2008, 11:42:25) [GCC 4.1.0 20060304 (Red Hat 4.1.0-3)] on linux2 Type help, copyright, credits or license for more information. import pickle f = open(test, rb) pickle.load(f) Traceback (most recent call last): File stdin, line 1, in module File /home/MC/hagenf/local/lib/python2.6/pickle.py, line 1370, in load return Unpickler(file).load() File /home/MC/hagenf/local/lib/python2.6/pickle.py, line 858, in load dispatch[key](self) File /home/MC/hagenf/local/lib/python2.6/pickle.py, line 1090, in load_global klass = self.find_class(module, name) File /home/MC/hagenf/local/lib/python2.6/pickle.py, line 1124, in find_class __import__(module) ImportError: No module named builtins -- components: Library (Lib) messages: 71916 nosy: hagen severity: normal status: open title: Python 2.6 can't read sets pickled with Python 3.0 versions: Python 2.6, Python 3.0 ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3675 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3675] Python 2.6 can't read sets pickled with Python 3.0
Changes by Antoine Pitrou [EMAIL PROTECTED]: -- nosy: +alexandre.vassalotti priority: - critical type: - behavior ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3675 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com