This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jcea
Recipients georg.brandl, jcea
Date 2011-02-22.13:56:04
SpamBayes Score 6.606271e-12
Marked as misclassified No
Message-id <1298382970.2.0.426359598125.issue11286@psf.upfronthosting.co.za>
In-reply-to
Content
I have 10MB pickled structure generated in Python 2.7. I only use basic
types (no clases) like sets, dictionaries, lists, strings, etc.

The pickle stores a lot of strings. Some of them should be "bytes",
while other should be "unicode". My idea is to import ALL the strings as
bytes in Python 3.2 and navigate the data structure to convert the
appropiate values to unicode, in a one-time operation (I version the
structure, so I can know if this conversion is already done, simply
storing a new version value).

But I get this error:

"""
Python 3.2 (r32:88445, Feb 21 2011, 13:34:07)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> >>> f=open("file.pickle", mode="rb").read()
>>> >>> len(f)
9847316
>>> >>> b=pickle.loads(f,encoding="latin1")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: operation forbidden on released memoryview object
"""

I use the encoding "latin1" for transparent byte/unicode conversion (do
not touch the values!).

This seems to be a bug in Python 3.2. Any suggestion?.

The bytestream is protocol 2.


PYTHON 3.1.3 loads the pickle just fine.

Trying to generate a testcase. I can't upload the pickle, because it contains propietary information.
History
Date User Action Args
2011-02-22 13:56:10jceasetrecipients: + jcea, georg.brandl
2011-02-22 13:56:10jceasetmessageid: <1298382970.2.0.426359598125.issue11286@psf.upfronthosting.co.za>
2011-02-22 13:56:04jcealinkissue11286 messages
2011-02-22 13:56:04jceacreate