[issue18473] some objects pickled by Python 3.x are not unpicklable in Python 2.x because of incorrect REVERSE_IMPORT_MAPPING
New submission from Mikhail Korobov: I think REVERSE_IMPORT_MAPPING is wrong (see http://hg.python.org/cpython/file/7272ef213b7c/Lib/_compat_pickle.py#l80 ). It relies on dictionary items order and maps 'collections' module to either UserString or UserList. This makes it impossible to unpickle collections module classes pickled by Python 3.x when using Python 2.x. >>> import collections >>> dct = collections.defaultdict() >>> pickle.dumps(dct, protocol=1) b'cUserString\ndefaultdict\nq\x00)Rq\x01.' >>> pickle.dumps(dct, protocol=2, fix_imports=False) b'ccollections\ndefaultdict\nq\x00)Rq\x01.' I think pickling of instances of classes from other modules could also suffer. I don't think it is a good idea to map io to cStringIO or StringIO, or to map http.server to either BaseHTTPServer, SimpleHTTPServer or CGIHTTPServer. Originally found this issue here: https://github.com/nltk/nltk/pull/441/files#L2R67 -- components: Library (Lib) messages: 193160 nosy: kmike priority: normal severity: normal status: open title: some objects pickled by Python 3.x are not unpicklable in Python 2.x because of incorrect REVERSE_IMPORT_MAPPING versions: Python 3.3 ___ Python tracker <http://bugs.python.org/issue18473> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18473] some objects pickled by Python 3.x are not unpicklable in Python 2.x because of incorrect REVERSE_IMPORT_MAPPING
Mikhail Korobov added the comment: my copy-paste went wrong, last statement in the example should be >>> pickle.dumps(dct, protocol=1, fix_imports=False) b'ccollections\ndefaultdict\nq\x00)Rq\x01.' -- ___ Python tracker <http://bugs.python.org/issue18473> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15027] Faster UTF-32 encoding
Changes by Mikhail Korobov : -- nosy: +kmike ___ Python tracker <http://bugs.python.org/issue15027> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6784] byte/unicode pickle incompatibilities between python2 and python3
Changes by Mikhail Korobov : -- nosy: +kmike ___ Python tracker <http://bugs.python.org/issue6784> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22003] BytesIO copy-on-write
Changes by Mikhail Korobov : -- nosy: +kmike ___ Python tracker <http://bugs.python.org/issue22003> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27464] Document that SplitResult & friends are namedtuples
New submission from Mikhail Korobov: Docs currently say that urllib.parse.SplitResult is a subclass of tuple, without saying that it is namedtuple. What do you think about documenting it as a namedtuple? It has an useful _replace method which allows to change some part of URL before passing it to urlunsplit. It may also require updating typeshed - I noticed this issue because mypy shows an error when SplitResult._replace is used. -- messages: 269964 nosy: kmike priority: normal severity: normal status: open title: Document that SplitResult & friends are namedtuples ___ Python tracker <http://bugs.python.org/issue27464> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22003] BytesIO copy-on-write
Mikhail Korobov added the comment: Shouldn't this fix be mentioned in https://docs.python.org/3.5/whatsnew/3.5.html#optimizations ? -- ___ Python tracker <http://bugs.python.org/issue22003> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com