[issue3067] setlocale error message is confusing

2011-11-05 Thread Petri Lehtinen
Petri Lehtinen 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-05 Thread Roundup Robot
Roundup Robot 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 in branch '3.2': Issue #3067: Enha

[issue3067] setlocale error message is confusing

2011-11-05 Thread Terry J. Reedy
Terry J. Reedy added the comment: Yes, parentheses would be better. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubs

[issue3067] setlocale error message is confusing

2011-11-05 Thread Petri Lehtinen
Petri Lehtinen 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 think that m

[issue3067] setlocale error message is confusing

2011-11-04 Thread Terry J. Reedy
Terry J. Reedy 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 code, encoding), or

[issue3067] setlocale error message is confusing

2011-11-04 Thread Petri Lehtinen
Petri Lehtinen added the comment: Terry: Do you still think there's need for a doc update? -- resolution: -> fixed status: open -> pending ___ Python tracker ___ ___

[issue3067] setlocale error message is confusing

2011-11-04 Thread Roundup Robot
Roundup Robot 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': Issue #3067: Fix the error raise

[issue3067] setlocale error message is confusing

2011-11-03 Thread Petri Lehtinen
Changes by Petri Lehtinen : -- nosy: +petri.lehtinen ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail

[issue3067] setlocale error message is confusing

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

[issue3067] setlocale error message is confusing

2011-10-18 Thread Martin v . Löwis
Martin v. Löwis 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 > it's valid type

[issue3067] setlocale error message is confusing

2011-10-18 Thread Jyrki Pulliainen
Jyrki Pulliainen 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 locale (like 'en

[issue3067] setlocale error message is confusing

2011-10-18 Thread Martin v . Löwis
Martin v. Löwis 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 report TypeError a

[issue3067] setlocale error message is confusing

2011-10-18 Thread Jyrki Pulliainen
Jyrki Pulliainen 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 "locale unpacki

[issue3067] setlocale error message is confusing

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

[issue3067] setlocale error message is confusing

2011-10-18 Thread Jyrki Pulliainen
Jyrki Pulliainen 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 ___

[issue3067] setlocale error message is confusing

2011-10-18 Thread Éric Araujo
Éric Araujo 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 tracker

[issue3067] setlocale error message is confusing

2011-10-18 Thread Jyrki Pulliainen
Jyrki Pulliainen 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 confusing when passin

[issue3067] setlocale error message is confusing

2011-06-20 Thread Roundup Robot
Roundup Robot 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-20 Thread Terry J. Reedy
Terry J. Reedy 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 to wait until >P

[issue3067] setlocale error message is confusing

2011-06-20 Thread STINNER Victor
STINNER Victor 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 support older Python versions

[issue3067] setlocale error message is confusing

2011-06-20 Thread Roundup Robot
Roundup Robot 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 -> committed/rejected stat

[issue3067] setlocale error message is confusing

2011-06-20 Thread STINNER Victor
STINNER Victor 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 remove Python 3 from the

[issue3067] setlocale error message is confusing

2011-06-20 Thread vincent.chute
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 s

[issue3067] setlocale error message is confusing

2011-06-19 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +haypo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.o

[issue3067] setlocale error message is confusing

2011-06-18 Thread Terry J. Reedy
Terry J. Reedy 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, 'string' in the doc can