[issue3067] setlocale error message is confusing

Martin v. Löwis report at bugs.python.org
Tue Oct 18 20:49:58 CEST 2011


Martin v. Löwis <martin at v.loewis.de> added the comment:

I think the reported exception type is incorrect. Given that the error message is 'Locale must be None, a string, or an iterable of two strings -- language code, encoding.', it very much sounds like a TypeError is being reported here.

So I think all that's needed is that the ValueError is converted into a TypeError.

Also notice that the tuple unpacking may actually succeed:

py> locale.setlocale(locale.LC_ALL,u"en")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/locale.py", line 513, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3067>
_______________________________________


More information about the Python-bugs-list mailing list