[Patches] [ python-Patches-1158909 ] unpack error in
getdefaultlocale() on certain locales
SourceForge.net
noreply at sourceforge.net
Thu Mar 10 17:07:00 CET 2005
Patches item #1158909, was opened at 2005-03-08 10:40
Message generated for change (Comment added) made by calvin
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1158909&group_id=5470
Category: Library (Lib)
Group: None
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: 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 LANG=de_DE at euro 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 en_EN at euro because England hasn't joined EU :)
If the code that tries to guess encoding is removed it will
raise an exception:
ValueError: unknown locale: en_EN at euro
Like locale command line tool prints warning:
LANG=en_EN at euro 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('en_EN at euro') still returns
'en_EN at euro'. 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('de_DE at euro') 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 LANG=de_DE at euro 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=305470&aid=1158909&group_id=5470
More information about the Patches
mailing list