This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rharris
Recipients rharris
Date 2008-04-17.17:24:34
SpamBayes Score 0.11786862
Marked as misclassified No
Message-id <1208453081.65.0.886847251895.issue2651@psf.upfronthosting.co.za>
In-reply-to
Content
Here is a bug in Python 2.5 which would be nice to fix for Py3k (since
we are already breaking compatibility):

Take a string:
s = "Hello"

Create a KeyError exception with that string:
e = KeyError(s)

Counterintuitively, casting the exception to a string doesn't return the
same string:
str(e) != s

Instead, when KeyError is cast to a string it affixes single-quotes
around the string.

I have create a test which shows that the other built-in exceptions
(except for 3 Unicode Errors which seem to be unusual in that they don't
accept just a string), do indeed round-trip the string unaltered.

This actually caused a bug (in an old version of zope.DocumentTemplate).

I am including the test case I wrote for now; I will begin looking into
a solution shortly and hopefully whip up a patch.
History
Date User Action Args
2008-04-17 17:24:42rharrissetspambayes_score: 0.117869 -> 0.11786862
recipients: + rharris
2008-04-17 17:24:41rharrissetspambayes_score: 0.117869 -> 0.117869
messageid: <1208453081.65.0.886847251895.issue2651@psf.upfronthosting.co.za>
2008-04-17 17:24:40rharrislinkissue2651 messages
2008-04-17 17:24:39rharriscreate