[issue2651] Strings passed to KeyError do not round trip
Amaury Forgeot d'Arc
report at bugs.python.org
Thu Apr 17 19:42:11 CEST 2008
Amaury Forgeot d'Arc <amauryfa at gmail.com> added the comment:
Here is a relevant comment inside the KeyError_str function:
/* If args is a tuple of exactly one item, apply repr to args[0].
This is done so that e.g. the exception raised by {}[''] prints
KeyError: ''
rather than the confusing
KeyError
alone. The downside is that if KeyError is raised with an
explanatory
string, that string will be displayed in quotes. Too bad.
If args is anything else, use the default BaseException__str__().
*/
Why is it so important to round trip?
----------
nosy: +amaury.forgeotdarc
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2651>
__________________________________
More information about the Python-bugs-list
mailing list