[New-bugs-announce] [issue6668] locale.py: can't parse sr_RS at latin locale

Vlada Peric report at bugs.python.org
Fri Aug 7 16:34:34 CEST 2009

New submission from Vlada Peric <vlada.peric at gmail.com>:

The sr_RS locale in glibc corresponds to the Cyrillic script, while the 
agreed upon locale for the Latin alphabet is sr_RS at latin. Unfortunately, 
the locale python module crashes when trying to parse this locale. Here 
is the traceback:

File "/usr/lib/python2.6/locale.py", line 497, in get locale
  return _parse_localename(localename)
File "usr/lib/python2.6/locale.py", line 410, in _parse_localename
  raise ValueError, 'unknown locale: %s' % localename

Looking at the code, it only checks for the @euro modifier and ignores 
all other modifiers (including @latin). This is all when I set 
LANG=sr_RS at latin. If I use LANG=sr_RS.UTF8 at latin (also allowed by 
glibc), Python interprets this as the sr_RS locale (which is wrong, as 
that is for Cyrillic).

components: Unicode
messages: 91404
nosy: VPeric
severity: normal
status: open
title: locale.py: can't parse sr_RS at latin locale
type: crash
versions: Python 2.6

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list