New submission from Rick Harris <[EMAIL PROTECTED]>: 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. ---------- components: Interpreter Core files: testExceptionStringRoundTrip.py messages: 65586 nosy: rharris severity: normal status: open title: Strings passed to KeyError do not round trip type: behavior versions: Python 2.5 Added file: http://bugs.python.org/file10048/testExceptionStringRoundTrip.py __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2651> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com