[Python-Dev] Strange error importing a Pickle from 2.7 to 3.2

Guido van Rossum guido at python.org
Wed Feb 23 22:07:11 CET 2011


I'm guessing that one of these encoding names is recognized by the C
code while the other one takes the slow path via the aliasing code.

On Wed, Feb 23, 2011 at 11:16 AM, Alexander Belopolsky
<alexander.belopolsky at gmail.com> wrote:
> On Tue, Feb 22, 2011 at 11:34 PM, Jesus Cea <jcea at jcea.es> wrote:
> ..
>> Issue filed. It already has a patch. That was fast!. Now I can sit back
>> waiting for 3.2.1 before touching my project again :). Mixed feelings
>> about the waiting. I hope it is short.
>
> It looks like you don't need delay your project: if you spell encoding
> as "latin-1", your pickle loads just fine:
>
>
>>>> with open("z.pickle", mode="rb") as f: pickle.load(f, encoding="latin-1")
> ...
> {'ya_volcados': {'comment': ''}}
>
>
> With encoding="latin1", it does fail:
>
>>>> with open("z.pickle", mode="rb") as f: pickle.load(f, encoding="latin1")
> ...
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
> ValueError: operation forbidden on released memoryview object
>
> (For those not following the tracker issue, the z.pickle file was
> posted at <http://bugs.python.org/file20839/z.pickle>.)
>
> There is still a bug, which is best demonstrated by
>
>>>> pickle.loads(b'\x80\x02U\x00.', encoding='latin1')
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
> ValueError: operation forbidden on released memoryview object
>
> The fact that the above works with encoding='latin-1',
>
>>>> pickle.loads(b'\x80\x02U\x00.', encoding='latin-1')
> ''
>
> shows that there is probably more than one bug.
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org
>



-- 
--Guido van Rossum (python.org/~guido)


More information about the Python-Dev mailing list