Bugs item #1678647, was opened at 2007-03-12 09:20 Message generated for change (Comment added) made by perky You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1678647&group_id=5470
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: Unicode Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Leandro Lucarella (llucax) Assigned to: M.-A. Lemburg (lemburg) Summary: Weird behavior Exception with unicode string Initial Comment: This simple python program: ------------------------------- raise Exception(u'Muri\u00f3') ------------------------------- prints: ----------------------------------- Traceback (most recent call last): File "pylog.py", line 1, in ? raise Exception(u'Muri\u00f3') Exception ----------------------------------- While not using an unicode character, seems to work fine (even if using an unicode parameter): -------------------------- raise Exception(u'Murio') -------------------------- prints: ----------------------------------- Traceback (most recent call last): File "pylog.py", line 1, in ? raise Exception(u'Murio') Exception: Murio ----------------------------------- This seems to break the logging module when calling logging.exception(u'Muri\u00f3'), for example. Tested in Python 2.4.4 and 2.5 (debian). ---------------------------------------------------------------------- >Comment By: Hye-Shik Chang (perky) Date: 2007-03-12 13:43 Message: Logged In: YES user_id=55188 Originator: NO That's from line 1216-1230 of Python/pythonrun.c as in trunk. It tries PyObject_Str(exception) and skips printing line terminator when it failed. And the behavior came from r8084 (http://svn.python.org/view/python/trunk/Python/pythonrun.c?rev=8084&r1=8070&r2=8084). Hmm. I think it should put a LF even if the conversion failed. (encoding the unicode with "ignore" or "replace" would make some confusion and putting it in PyObject_Repr() makes inconsistency.) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1678647&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com