[issue3067] setlocale error message is confusing
vincent.chute added the comment: "Since the module predates unicode strings (it is in 1.5) and since the locale string is passed to a C function, 'string' in the doc can just as well be taken to mean ascii byte string only, as the code requires." My only comment is that generally it doesn't seem reasonable to me that developer should need to investigate the history and implementation of a function in order to understand the documentation correctly. -- ___ Python tracker <http://bugs.python.org/issue3067> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3067] setlocale Tracebacks on unicode locale strings
New submission from vincent.chute <[EMAIL PROTECTED]>: import locale locale.setlocale( locale.LC_ALL, u'ja_JP.utf8') Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.5/locale.py", line 475, in setlocale locale = normalize(_build_localename(locale)) File "/usr/lib/python2.5/locale.py", line 383, in _build_localename language, encoding = localetuple ValueError: too many values to unpack The problem is line 473: if locale and type(locale) is not type(""): Replacing this with if locale and not isinstance(locale, basestring): fixes the problem. ------ components: Library (Lib) messages: 67861 nosy: vincent.chute severity: normal status: open title: setlocale Tracebacks on unicode locale strings versions: Python 2.5 ___ 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
[issue3067] setlocale Tracebacks on unicode locale strings
vincent.chute <[EMAIL PROTECTED]> added the comment: I have confirmed this exists on trunk http://svn.python.org/view/python/trunk/Lib/locale.py?rev=63824&view=markup (63824 is the latest) where the line in question is now 475 ___ 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