[issue12596] cPickle - stored data differ for same dictionary
Serhiy Storchaka
report at bugs.python.org
Sun Feb 17 23:27:33 CET 2013
Serhiy Storchaka added the comment:
Here is a minimal reproducer. Results:
pickle.dumps('spam', 2)
0: \x80 PROTO 2
2: U SHORT_BINSTRING 'spam'
8: q BINPUT 0
10: . STOP
highest protocol among opcodes = 2
pickle.dumps('spam1'[:-1], 2)
0: \x80 PROTO 2
2: U SHORT_BINSTRING 'spam'
8: q BINPUT 0
10: . STOP
highest protocol among opcodes = 2
cPickle.dumps('spam', 2)
0: \x80 PROTO 2
2: U SHORT_BINSTRING 'spam'
8: q BINPUT 1
10: . STOP
highest protocol among opcodes = 2
cPickle.dumps('spam1'[:-1], 2)
0: \x80 PROTO 2
2: U SHORT_BINSTRING 'spam'
8: . STOP
highest protocol among opcodes = 2
The difference between 3rd and 4th examples is "BINPUT 1". In the last case the string has refcount=1 and BINPUT doesn't emitted due to optimization. Note that Python implementation emits BINPUT with different number.
----------
Added file: http://bugs.python.org/file29108/cPickletest2.py
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12596>
_______________________________________
More information about the Python-bugs-list
mailing list