From: SourceForge.net <no...@so...> - 2007-08-22 23:34:44
|
Patches item #1775263, was opened at 2007-08-16 10:20 Message generated for change (Comment added) made by pjenvey You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312867&aid=1775263&group_id=12867 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: ayesha (ayeshaiqbal) Assigned to: Nobody/Anonymous (nobody) Summary: patch for bug [1768979]:hasattr,getattr Initial Comment: This fix checks whether the attribute string is unicode.If SO a UnicodeError is raised.The test file test_builtin now executes without any error Thanks, Ayesha ---------------------------------------------------------------------- Comment By: Philip Jenvey (pjenvey) Date: 2007-08-23 00:34 Message: Logged In: YES user_id=145787 Originator: NO 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 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312867&aid=1775263&group_id=12867 |