diferences between 22 and python 23

Peter Hansen peter at engcorp.com
Wed Dec 3 21:16:46 CET 2003


"Mike C. Fletcher" wrote:
> 
> Fredrik Lundh wrote:
> 
> >Enrique wrote:
> >>Usually major versions of python were courteus with the previous versions...
> >
> >0xED has never been a valid 7-bit ASCII character.
> >
> Sure, but Python used to accept 8-bit characters in the platform's
> default encoding as part of string characters...
> 
> Most likely Enrique has a \xED somewhere in a string literal in his code
> that is intended to be an i-accent-ague.  That would have worked fine in
> all versions of Python before 2.3, but started failing in 2.3 due to the
> decision that all string literals would be converted to unicode and back
> and that the default encoding for such conversions would be ASCII
> (whereas previously it would most closely have been approximated by
> "platform's local 256-char encoding").
[snip]
> Which doesn't actually mention the breakage of code that results.  True,
> theoretically the code was never valid, but *lots* of people used 8-bit
> encodings quite happily with earlier versions and do find their code
> breaking in 2.3 because of this.

Wait a sec... are you telling me that my code, which has strings containing
binary data (which I believe has *always* been permitted), and which from
time to time might, say, produce an error traceback containing the content
from one such string and write it to a log file, then continue processing
safely, will now fail with an ugly crash because I haven't changed it to
specify a default encoding? (!!!)

I've been watching this "value XX with high bit set was never a valid 7-bit 
ASCII" discussion with only one eye for quite some time now, somewhat curious
why so many people were having troubles.  I assume it was merely that they
were using *names* that contained non-ASCII characters, in their source code.

Are you saying that this change is actually breaking code that happens to
have these perfectly valid binary strings stored in string constants?

I'm very unimpressed with this decision if that's the case.

-Peter




More information about the Python-list mailing list