homepage

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 amaury.forgeotdarc
Recipients amaury.forgeotdarc, benjamin.peterson, christoph
Date 2008年03月31日.23:10:48
SpamBayes Score 0.08957664
Marked as misclassified No
Message-id <1207005049.2.0.119955214563.issue2517@psf.upfronthosting.co.za>
In-reply-to
Content
Even in 2.5, __str__ is allowed to return a Unicode object;
we could change BaseException_str this way:
Index: exceptions.c
===================================================================
--- exceptions.c	(revision 61957)
+++ exceptions.c	(working copy)
@@ -108,6 +104,11 @@
 break;
 case 1:
 out = PyObject_Str(PyTuple_GET_ITEM(self->args, 0));
+ if (out == NULL &&
PyErr_ExceptionMatches(PyExc_UnicodeEncodeError))
+ {
+ PyErr_Clear();
+ out = PyObject_Unicode(PyTuple_GET_ITEM(self->args, 0));
+ }
 break;
 default:
 out = PyObject_Str(self->args);
Then str(e) still raises UnicodeEncodeError,
but unicode(e) returns the original message.
But I would like the opinion of an experimented core developer...
History
Date User Action Args
2008年03月31日 23:10:49amaury.forgeotdarcsetspambayes_score: 0.0895766 -> 0.08957664
recipients: + amaury.forgeotdarc, benjamin.peterson, christoph
2008年03月31日 23:10:49amaury.forgeotdarcsetspambayes_score: 0.0895766 -> 0.0895766
messageid: <1207005049.2.0.119955214563.issue2517@psf.upfronthosting.co.za>
2008年03月31日 23:10:48amaury.forgeotdarclinkissue2517 messages
2008年03月31日 23:10:48amaury.forgeotdarccreate

AltStyle によって変換されたページ (->オリジナル) /