[issue3067] setlocale error message is confusing

2011-11-05 Thread Petri Lehtinen
Petri Lehtinen pe...@digip.org added the comment: If *locale* is specified, it may be a None, a string, or an iterable of two strings, language code and encoding. String pairs are converted to a single string using the locale aliasing engine. What about the possible None value then? Do you

[issue3067] setlocale error message is confusing

2011-11-05 Thread Terry J. Reedy
Terry J. Reedy tjre...@udel.edu added the comment: Yes, parentheses would be better. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3067 ___ ___

[issue3067] setlocale error message is confusing

2011-11-05 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 34c9465f5023 by Petri Lehtinen in branch '2.7': Issue #3067: Enhance the documentation and docstring of locale.setlocale() http://hg.python.org/cpython/rev/34c9465f5023 New changeset 98806dd03506 by Petri Lehtinen

[issue3067] setlocale error message is confusing

2011-11-05 Thread Petri Lehtinen
Petri Lehtinen pe...@digip.org added the comment: I decided to restructure the documentation of setlocale() a bit and I think it's better now overall. It includes Terry's suggestions. I think this issue can now be closed. Thanks for the report and patches! -- status: open - closed

[issue3067] setlocale error message is confusing

2011-11-04 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 931ae170e51c by Petri Lehtinen in branch '3.2': Issue #3067: Fix the error raised by locale.setlocale() http://hg.python.org/cpython/rev/931ae170e51c New changeset d90d88380aca by Petri Lehtinen in branch 'default':

[issue3067] setlocale error message is confusing

2011-11-04 Thread Petri Lehtinen
Petri Lehtinen pe...@digip.org added the comment: Terry: Do you still think there's need for a doc update? -- resolution: - fixed status: open - pending ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3067

[issue3067] setlocale error message is confusing

2011-11-04 Thread Terry J. Reedy
Terry J. Reedy tjre...@udel.edu added the comment: Yes. I think in locale.rst (assuming that is the name) ''' exception locale.Error Exception raised when setlocale() fails. locale.setlocale(category, locale=None) If *locale* is specified, it may be a string, a tuple of the form (language

[issue3067] setlocale error message is confusing

2011-11-03 Thread Petri Lehtinen
Changes by Petri Lehtinen pe...@digip.org: -- nosy: +petri.lehtinen ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3067 ___ ___ Python-bugs-list

[issue3067] setlocale error message is confusing

2011-10-18 Thread Jyrki Pulliainen
Jyrki Pulliainen jy...@dywypi.org added the comment: Added a patch that implements two things: setlocale now raises locale.Error('Locale must be None, a string, or an iterable of two strings -- language code, encoding.'). I decided to remove the proposed .format(locale), as it wasa a bit

[issue3067] setlocale error message is confusing

2011-10-18 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Thanks for the patch. Exception messages are considered implementation details, so I would not test them. Testing that an exception is raised is good enough IMO. -- nosy: +eric.araujo ___ Python

[issue3067] setlocale error message is confusing

2011-10-18 Thread Jyrki Pulliainen
Jyrki Pulliainen jy...@dywypi.org added the comment: I modified the patch not to contain the tests against exception messages -- Added file: http://bugs.python.org/file23447/issue3067_v2.patch ___ Python tracker rep...@bugs.python.org

[issue3067] setlocale error message is confusing

2011-10-18 Thread Martin v . Löwis
Martin v. Löwis mar...@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

[issue3067] setlocale error message is confusing

2011-10-18 Thread Jyrki Pulliainen
Jyrki Pulliainen jy...@dywypi.org added the comment: Maybe we should return TypeError with the same message then? That would require some modification of documentation though, as it states: If the modification of the locale fails, the exception Error is raised.. I don't really understand the

[issue3067] setlocale error message is confusing

2011-10-18 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: Maybe we should return TypeError with the same message then? That would require some modification of documentation though, as it states: If the modification of the locale fails, the exception Error is raised.. No, any operation can

[issue3067] setlocale error message is confusing

2011-10-18 Thread Jyrki Pulliainen
Jyrki Pulliainen jy...@dywypi.org added the comment: Thanks for clarification! I see the problem now. So if I get this correctly we should change the _build_localename to raise TypeError? If the given locale is in wrong format, we'll get TypeError, but if it's valid type but otherwise invalid

[issue3067] setlocale error message is confusing

2011-10-18 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: Thanks for clarification! I see the problem now. So if I get this correctly we should change the _build_localename to raise TypeError? Yes, that's what I'm proposing. If the given locale is in wrong format, we'll get TypeError, but if

[issue3067] setlocale error message is confusing

2011-10-18 Thread Jyrki Pulliainen
Jyrki Pulliainen jy...@dywypi.org added the comment: Uploaded a new patch that raises TypeError -- Added file: http://bugs.python.org/file23452/issue3067_v3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3067

[issue3067] setlocale error message is confusing

2011-06-20 Thread vincent.chute
vincent.chute vincent.ch...@onelan.co.uk 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

[issue3067] setlocale error message is confusing

2011-06-20 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: On Py3, locale.setlocale() should allow only unicode strings and reject byte strings. I agree and it is the current behaviour (of Python 3.3). I don't see any use case of a byte strings in locale.setlocale() with Python 3.3, so I

[issue3067] setlocale error message is confusing

2011-06-20 Thread Roundup Robot
Roundup Robot devnull@devnull added the comment: New changeset d370d609d09b by Victor Stinner in branch '2.7': Close #3067: locale.setlocale() accepts a Unicode locale. http://hg.python.org/cpython/rev/d370d609d09b -- nosy: +python-dev resolution: - fixed stage: test needed -

[issue3067] setlocale error message is confusing

2011-06-20 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: I fixed locale.setlocale() of Python 2.7 to accept Unicode string because it helps porting to Python 3... But I think that the commit is just useless because we will have to wait until Python 2.7.3 is released, and if you want to

[issue3067] setlocale error message is confusing

2011-06-20 Thread Terry J. Reedy
Terry J. Reedy tjre...@udel.edu added the comment: Victor, the issue for 3.x, which remains, is to improve the error message. I also suggested a doc change, though I would like Mark or Martin's comments before I would make it. But I think that the commit is just useless because we will have

[issue3067] setlocale error message is confusing

2011-06-20 Thread Roundup Robot
Roundup Robot devnull@devnull added the comment: New changeset e72a2a60316f by Victor Stinner in branch '2.7': Revert d370d609d09b as requested by Terry Jan Reedy: http://hg.python.org/cpython/rev/e72a2a60316f -- ___ Python tracker

[issue3067] setlocale error message is confusing

2011-06-19 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@haypocalc.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3067 ___ ___

[issue3067] setlocale error message is confusing

2011-06-18 Thread Terry J. Reedy
Terry J. Reedy tjre...@udel.edu added the comment: After more thought and investigation, I have changed my opinions on this issue. Allowing unicode string for locale in 2.7: Since the module predates unicode strings (it is in 1.5) and since the locale string is passed to a C function,