[Merge] lp:~mvo/ubuntu/quantal/dbus-python/lp846044 into lp:ubuntu/dbus-python
Ramseth ,Sethos
boy81de at yahoo.de
Mon Jul 4 05:52:51 UTC 2016
> This is a bit nasty it seems because of the way Objects/exceptions.c is
> implemented in py2:
> ...
> 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;
> }
> ...
>
> i.e. it will look at the __str__() method and if that is there calls it and
> then calls unicode() on it.
> This means that we can't have __str__ in py2 afaict or we always need to
> ensure that "self.args" is type str never unicode.
--
https://code.launchpad.net/~mvo/ubuntu/quantal/dbus-python/lp846044/+merge/129214
Your team Ubuntu branches is requested to review the proposed merge of lp:~mvo/ubuntu/quantal/dbus-python/lp846044 into lp:ubuntu/quantal/dbus-python.
More information about the Ubuntu-reviews
mailing list