yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #02523
[Bug 1168879] Re: Error with unicode error message
** Changed in: keystone
Status: Fix Committed => Fix Released
** Changed in: keystone
Milestone: None => havana-1
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Keystone.
https://bugs.launchpad.net/bugs/1168879
Title:
Error with unicode error message
Status in OpenStack Identity (Keystone):
Fix Released
Bug description:
Keystone exceptions inherited from keystone.exception.Error can only
take acsii message as the message arguments to construct exception
instances.
Because keystone.exception.Error inherits from StandardError which in
cpython, has a somewhat "buggy" implementation of __unicode__ as
following,
static PyObject *
BaseException_unicode(PyBaseExceptionObject *self)
{
PyObject *out;
/* issue6108: if __str__ has been overridden in the subclass, unicode()
should return the message returned by __str__ as used to happen
before this method was implemented. */
if (Py_TYPE(self)->tp_str != (reprfunc)BaseException_str) {
PyObject *str;
/* Unlike PyObject_Str, tp_str can return unicode (i.e. return the
equivalent of unicode(e.__str__()) instead of unicode(str(e))). */
str = Py_TYPE(self)->tp_str((PyObject*)self);
if (str == NULL)
return NULL;
out = PyObject_Unicode(str);
Py_DECREF(str);
return out;
}
switch (PyTuple_GET_SIZE(self->args)) {
case 0:
out = PyUnicode_FromString("");
break;
case 1:
out = PyObject_Unicode(PyTuple_GET_ITEM(self->args, 0));
break;
default:
out = PyObject_Unicode(self->args);
break;
}
return out;
}
thus that whenever keystone.exception.Error.__unicode__ is called, the
call will be forwarded to keystone.exception.Error.__str__. And it
will cause problem if its error message is unicode string.
To manage notifications about this bug go to:
https://bugs.launchpad.net/keystone/+bug/1168879/+subscriptions