That's the right idea Alexander, but the ability to pass multiple parameters to the unicode() function is there to catch you out - it only works on buffer-type objects, and exception instance attributes can be anything.
>>> unicode(object())
u'<object object at 0x00AB14C8>'
>>> unicode(object(), "ascii")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: coercing to Unicode: need string or buffer, object found
I'm still not quite sure what exactly this exception stringifying needs, but will put up a branch for review.
That's the right idea Alexander, but the ability to pass multiple parameters to the unicode() function is there to catch you out - it only works on buffer-type objects, and exception instance attributes can be anything.
>>> unicode(object())
u'<object object at 0x00AB14C8>'
>>> unicode(object(), "ascii")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: coercing to Unicode: need string or buffer, object found
I'm still not quite sure what exactly this exception stringifying needs, but will put up a branch for review.