Author pjenvey
Date 2007-08-22.23:34:41
SpamBayes Score
Marked as misclassified
throwing a UnicodeError here isn't the same as CPython. Since CPython is dealing with an actual unicode object, it will encode() it, and when the encoding fails you'll end up with the typical UnicodeEncodeError: 'ascii' codec can't encode character u'\xe' in position 0: ordinal not in range(128)

This patch's behavior is similar, but python code will be expecting to catch UnicodeEncodeErrors when these operations fail, not its base class UnicodeError.

You might want to force an encode operation here instead. If encode() is much slower than isunicode, maybe only encode() if isunicode() returns true. You could also throw the UnicodeEncodeError yourself, but preserving the full UnicodeEncodeError's message with the failed character and its position is preferable -- for developers to see exactly why it failed
Date User Action Args
2008-02-20 17:18:46adminlinkissue1775263 messages
2008-02-20 17:18:46admincreate