[issue6137] Make pickle generated by Python 3.x compatible with 2.x and vice-versa.

Alexandre Vassalotti report at bugs.python.org
Thu Jun 4 03:18:58 CEST 2009


Alexandre Vassalotti <alexandre at peadrop.com> added the comment:

Here is an updated patch based on Antoine's latest patch.

Summary of changes:
 * Updated docstrings of Pickler and Unpickler in the pickle module.
 * Fixed pickle._Pickler to consider fix_imports only for protocol < 3
 * Made module name remapping in _pickle more robust:
    - added PyUnicode_Check on global_name and module_name;
    - used PyDict_GetItemWithError instead of PyDict_GetItem
 * Changed Py_BuildValue("(OO)", ...) to its faster equivalent
   PyTuple_Pack(2, ...).

I don't really the idea of remapping names generated by Pickler, since
it breaks the identity guarantee in save_global(). However, I agree this
is an example where practicality beats purity. So, I do not oppose to
the change.

----------
assignee:  -> alexandre.vassalotti
title: Pickle migration: Should pickle map "copy_reg" to "copyreg"? -> Make pickle generated by Python 3.x compatible with 2.x and vice-versa.
Added file: http://bugs.python.org/file14184/compat_pickle6.diff

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


More information about the Python-bugs-list mailing list