[pypy-issue] [issue1693] pickle.dumps results in different raw strings in PyPy vs CPython2.7

Daniel Axtens tracker at bugs.pypy.org
Thu Feb 13 01:57:31 CET 2014


New submission from Daniel Axtens <daniel at axtens.net>:

PyPy 2.2.1 is generating different pickles of instances of new-style classes to CPython 2.7. It's also not generating stable pickles: 
pickling an instance new-style class, restoring it and then pickling it again gives a different result.

The objects are being restored fine, so it's a very minor issue - it's just triggering some tests in a project I'm working on that are 
comparing raw pickles. 

Test code is attached.

Test setup: Mac OS 10.8 on a 2GHz MacBook5,1 with 8GB ram
uname -a: 
Darwin Daniels-MacBook.local 12.5.0 Darwin Kernel Version 12.5.0: Sun Sep 29 13:33:47 PDT 2013; root:xnu-2050.48.12~1/RELEASE_X86_64 x86_64
pypy --version: 
Python 2.7.3 (87aa9de10f9c, Nov 24 2013, 20:57:21)
[PyPy 2.2.1 with GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)]
python --version: 
Python 2.7.2

python testpypypickle.py:
"ccopy_reg\n_reconstructor\np0\n(c__main__\nA\np1\nc__builtin__\nobject\np2\nNtp3\nRp4\n(dp5\nS'a'\np6\nI1\nsS'c'\np7\nI3\nsS'a_a'\np8\nI2\ns
b."
"ccopy_reg\n_reconstructor\np0\n(c__main__\nA\np1\nc__builtin__\nobject\np2\nNtp3\nRp4\n(dp5\nS'a'\np6\nI1\nsS'c'\np7\nI3\nsS'a_a'\np8\nI2\ns
b."
'\x80\x02c__main__\nA\nq\x00)\x81q\x01}q\x02(U\x01aq\x03K\x01U\x01cq\x04K\x03U\x03a_aq\x05K\x02ub.'
'\x80\x02c__main__\nA\nq\x00)\x81q\x01}q\x02(U\x01aq\x03K\x01U\x01cq\x04K\x03U\x03a_aq\x05K\x02ub.'

pypy testpypypickle.py:
"ccopy_reg\n_reconstructor\np0\n(c__main__\nA\np1\nc__builtin__\nobject\np2\nNtp3\nRp4\n(dp5\nS'c'\np6\nI3\nsS'a_a'\np7\nI2\nsS'a'\np8\nI1\ns
b."
"ccopy_reg\n_reconstructor\np0\n(c__main__\nA\np1\nc__builtin__\nobject\np2\nNtp3\nRp4\n(dp5\nS'a_a'\np6\nI2\nsS'c'\np7\nI3\nsS'a'\np8\nI1\ns
b."
'\x80\x02c__main__\nA\nq\x00)\x81q\x01}q\x02(U\x01cq\x03K\x03U\x03a_aq\x04K\x02U\x01aq\x05K\x01ub.'
'\x80\x02c__main__\nA\nq\x00)\x81q\x01}q\x02(U\x03a_aq\x03K\x02U\x01cq\x04K\x03U\x01aq\x05K\x01ub.'

P.S. Does the pickle format actually makes any promises about the ordering of things in raw pickles? If not, this is not actually a bug and 
I'll fix the tests instead.

----------
files: testpypypickle.py
messages: 6543
nosy: dja, pypy-issue
priority: bug
release: 2.2
status: unread
title: pickle.dumps results in different raw strings in PyPy vs CPython2.7

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1693>
________________________________________


More information about the pypy-issue mailing list