Serhiy Storchaka added the comment:

Thank you for your report Anil.

Python 3.4.3 creates incorrect pickle with protocol 2 (it can't be load in 
Python 2). issue18473 fixed pickling with protocol 2 in Python 3, but broke 
loading broken pickles created in unpatched versions of Python 3.

Here is a patch that allows to load such broken pickles.

But it is too late to fix Python 3.4, it can get only security fixes. You have 
Celery specific workaround. More general workaround is to update 
_compact_pickle.IMPORT_MAPPING, e.g.:

import _compact_pickle
_compact_pickle.IMPORT_MAPPING.update({
    'UserDict': 'collections',
    'UserList': 'collections',
    'UserString': 'collections',
    'whichdb': 'dbm',
    'StringIO':  'io',
    'cStringIO': 'io',
})

Note that you have to set mapping not just for one module name like 'UserList', 
but for all 'UserDict', 'UserList', and 'UserString', because it is not 
predicable to what module name 'collections' is mapped in Python 3.4.3.

----------
assignee:  -> serhiy.storchaka
components: +Library (Lib)
keywords: +patch
nosy: +alexandre.vassalotti, pitrou, serhiy.storchaka
stage:  -> patch review
versions: +Python 3.6
Added file: http://bugs.python.org/file41504/unpickle_broken_import.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26013>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to