Bugs item #1158909, was opened at 2005-03-08 10:40 Message generated for change (Comment added) made by lemburg You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1158909&group_id=5470
>Category: Python Library >Group: Python 2.5 Status: Open Resolution: None Priority: 5 Submitted By: Wummel (calvin) Assigned to: M.-A. Lemburg (lemburg) Summary: unpack error in getdefaultlocale() on certain locales Initial Comment: Patch fixes the locale breakage mentioned in the bug by using the normalized locale var. Patch is against current CVS. ---------------------------------------------------------------------- >Comment By: M.-A. Lemburg (lemburg) Date: 2005-03-10 18:22 Message: Logged In: YES user_id=38388 Change ticket type to bug. ---------------------------------------------------------------------- Comment By: Wummel (calvin) Date: 2005-03-10 17:06 Message: Logged In: YES user_id=9205 Oops, I misread the bug report #1158490. I thought it is the same problem as described here. This is a separate issue, and I edited the summary accordingly. The bug can be reproduced with: $ env -i [EMAIL PROTECTED] python2.5 -c "import locale; print locale.getdefaultlocale()" Sorry for the misunderstanding. ---------------------------------------------------------------------- Comment By: M.-A. Lemburg (lemburg) Date: 2005-03-10 16:43 Message: Logged In: YES user_id=38388 Sorry, but this patch doesn't fix the bug. See bug #1158490 for discussion. ---------------------------------------------------------------------- Comment By: Serge Orlov (sorlov) Date: 2005-03-10 15:01 Message: Logged In: YES user_id=1235914 Sorry, I mean England hasn't accepted euro as default currency, not that England hasn't joined EU. Sometimes I write not what I think :) ---------------------------------------------------------------------- Comment By: Serge Orlov (sorlov) Date: 2005-03-10 14:58 Message: Logged In: YES user_id=1235914 There is no [EMAIL PROTECTED] because England hasn't joined EU :) If the code that tries to guess encoding is removed it will raise an exception: ValueError: unknown locale: [EMAIL PROTECTED] Like locale command line tool prints warning: [EMAIL PROTECTED] locale charmap locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_MESSAGES to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: No such file or directory ANSI_X3.4-1968 ---------------------------------------------------------------------- Comment By: Wummel (calvin) Date: 2005-03-09 22:35 Message: Logged In: YES user_id=9205 Wouldn't removing the if '@' stuff break other cases? For example locale.normalize('[EMAIL PROTECTED]') still returns '[EMAIL PROTECTED]'. In this case the @euro part would not get split off and will be returned. When I understand the documentation of getdefaultlocale() correctly, it is not supposed to return the @euro part. ---------------------------------------------------------------------- Comment By: Serge Orlov (sorlov) Date: 2005-03-09 21:31 Message: Logged In: YES user_id=1235914 I think the correct fix is to remove the whole if '@' in code:. There is also a comment that the code under if is bogus. The reason for the breakage is that locale.normalize('[EMAIL PROTECTED]') started to return de_DE.ISO8859-15 ---------------------------------------------------------------------- Comment By: Wummel (calvin) Date: 2005-03-09 20:59 Message: Logged In: YES user_id=9205 I forgot an example. this fails for me on current CVS: $ env [EMAIL PROTECTED] python2.5 -c "import locale; print locale.getdefaultlocale()" Traceback (most recent call last): File "<string>", line 1, in ? File "/usr/local/lib/python2.5/locale.py", line 357, in getdefaultlocale return _parse_localename(localename) File "/usr/local/lib/python2.5/locale.py", line 280, in _parse_localename code, modifier = code.split('@') ValueError: need more than 1 value to unpack The error is that the @ char is searched in the original locale, but the split is done on the normalized locale. Hence the unpack error. ---------------------------------------------------------------------- Comment By: Serge Orlov (sorlov) Date: 2005-03-09 20:26 Message: Logged In: YES user_id=1235914 I don't get what this patch fixes. It actually changes handling of locales with @ sign, but there is no mentioning of that in bug 1158490. What do I miss? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1158909&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com