Ezio Melotti <[email protected]> added the comment:
FWIW the type("") is gone in Py3, now it is:
"if locale and not isinstance(locale, _builtin_str):"
where "from builtins import str as _builtin_str"
(http://svn.python.org/view/python/branches/py3k/Lib/locale.py?view=markup)
However Py3.0 now raises the same error when the second arg is a byte
string:
>>> locale.setlocale(locale.LC_ALL, b'ja_JP.utf8')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Programs\Python30\lib\locale.py", line 500, in setlocale
locale = normalize(_build_localename(locale))
File "C:\Programs\Python30\lib\locale.py", line 408, in _build_localename
language, encoding = localetuple
ValueError: too many values to unpack
On Py3, locale.setlocale() should allow only unicode strings and reject
byte strings.
----------
components: +Unicode
nosy: +ezio.melotti
title: setlocale Tracebacks on unicode locale strings -> setlocale fails with
unicode strings on Py2 and with byte strings on Py3
versions: +Python 2.6, Python 3.0
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue3067>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com