On Sat, Aug 06, 2005 at 06:56:39PM -0700, Guido van Rossum wrote: > My first response to the PEP, however, is that instead of a new > built-in function, I'd rather relax the requirement that str() return > an 8-bit string -- after all, int() is allowed to return a long, so > why couldn't str() be allowed to return a Unicode string?
I've played with this idea a bit and it seems viable. I modified my original patch to have string_new call PyObject_Text instead of PyObject_Str. That change breaks only two tests, both in test_email. The tracebacks are attached. Both problems seem relatively shallow. Do you thing such a change could go into 2.5? Neil Traceback (most recent call last): File "/home/nas/Python/py_cvs/Lib/email/test/test_email.py", line 2844, in test_encoded_adjacent_nonencoded h = make_header(decode_header(s)) File "/home/nas/Python/py_cvs/Lib/email/Header.py", line 123, in make_header charset = Charset(charset) File "/home/nas/Python/py_cvs/Lib/email/Charset.py", line 190, in __init__ input_charset = unicode(input_charset, 'ascii').lower() TypeError: decoding Unicode is not supported Traceback (most recent call last): File "/home/nas/Python/py_cvs/Lib/email/test/test_email.py", line 2750, in test_multilingual eq(decode_header(enc), File "/home/nas/Python/py_cvs/Lib/email/Header.py", line 85, in decode_header dec = email.quopriMIME.header_decode(encoded) File "/home/nas/Python/py_cvs/Lib/email/quopriMIME.py", line 319, in header_decode return re.sub(r'=\w{2}', _unquote_match, s) File "/home/nas/Python/py_cvs/Lib/sre.py", line 142, in sub return _compile(pattern, 0).sub(repl, string, count) UnicodeDecodeError: 'ascii' codec can't decode byte 0xfc in position 0: ordinal not in range(128) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com