[Python-Dev] unicode Exception messages in py2.7
Tres Seaver
tseaver at palladion.com
Thu Nov 14 22:55:19 CET 2013
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 11/14/2013 04:02 PM, Benjamin Peterson wrote:
> 2013/11/14 Chris Barker <chris.barker at noaa.gov>:
>> So a proposal:
>>
>> Use 'replace" mode for the encoding to the default, and at least
>> the user would see SOMETHING of the message. In a common case, it
>> would be a lot of ascii, and in the worse case it would be a lot of
>> question marks -- still better than a totally blank message.
>>
>> Another option would be to use the str(repr(the_message)) so the
>> user would get the escaped version. Though I think that would be
>> more ugly.
>
> Unfortunately both of these things change behavior so cannot be
> changed in Python 2.7.
Fixing any bug is "changing behavior"; 2.7 is not frozen for bugfixes.
The real question is whether third-party code will break when the
now-empty error messages appear with '?' littered through them?
About the only things I can think of which might break would be doctests,
but people *expect* those to break across third-dot releases of Python
(one reason why I hate them). Exception repr is explicitly *not* part of
any backward-compatibility guarantees in Python. Or code which
explicitly works around the breakage could fail (urlparse changes between
2.7.3 and 2.7.4, anyone?d(
Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver at palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iEYEARECAAYFAlKFRscACgkQ+gerLs4ltQ6JIgCgvNxHugjjbR3L1crSDK0QJiLb
LSYAn2cJnZ8almcfCmWHKhOnCP69bpB3
=MIFq
-----END PGP SIGNATURE-----
More information about the Python-Dev
mailing list