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

Alexander Belopolsky alexander.belopolsky at gmail.com
Wed Feb 23 22:13:14 CET 2011


On Wed, Feb 23, 2011 at 4:07 PM, Guido van Rossum <guido at python.org> wrote:
> 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.

This is absolutely right.  In fact I am going to propose adding
strcmp(lower, "latin1") to the following test in
PyUnicode_AsEncodedString():


	else if ((strcmp(lower, "latin-1") == 0) ||
                 (strcmp(lower, "iso-8859-1") == 0))
            return PyUnicode_EncodeLatin1(...

I'll open a separate issue for that.  In Python's own stdlib and tests
"latin1" is a more common spelling than "latin-1", so it makes sense
to optimize it.


More information about the Python-Dev mailing list