[New-bugs-announce] [issue8738] cPickle dumps(tuple) != dumps(loads(dumps(tuple)))

Alberto Planas Domínguez report at bugs.python.org
Mon May 17 12:45:20 CEST 2010


New submission from Alberto Planas Domínguez <aplanas at gmail.com>:

Sometimes, when I use cPickle to serialize tuples of strings, I get different dumps() result for the same tuple:

import cPickle
t = ('<s>', 'JOHN')
s1 = cPickle.dumps(t)
s2 = cPickle.dumps(cPickle.loads(cPickle.dumps(t)))
assert s1 == s2     # AssertionError

With cPickle doesn't matter what protocol use por dumps(). The assertion is Ok if I use the pickle module instead of cPickle.

This means that I can't use a serialized object as a key in a map/dict object.

----------
messages: 105896
nosy: Alberto.Planas.Domínguez
priority: normal
severity: normal
status: open
title: cPickle dumps(tuple) != dumps(loads(dumps(tuple)))
type: behavior
versions: Python 2.6

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


More information about the New-bugs-announce mailing list