Bug 758937 - locale.setlocale doesn't allow setting tuple
Summary: locale.setlocale doesn't allow setting tuple
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: python
Version: 5.8
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: rc
: ---
Assignee: Dave Malcolm
QA Contact: BaseOS QE - Apps
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-12-01 01:30 UTC by Matěj Cepl
Modified: 2013-03-15 04:25 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-03-15 04:25:34 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Matěj Cepl 2011-12-01 01:30:33 UTC
Description of problem:
According to pydoc locale function setlocale should

    setlocale(category, locale=None)
        Set the locale for the given category.  The locale can be
        a string, a locale tuple (language code, encoding), or None.
        
        Locale tuples are converted to strings the locale aliasing
        engine.  Locale strings are passed directly to the C lib.
        
        category may be given as one of the LC_* values.

However, when I try to run

     locale.setlocale(locale.LC_ALL, ("cs_CZ", "utf-8"))

(which works perfectly well on RHEL 6, and Fedoras), I get this backtrace

[mcepl@shell ~]$ python
Python 2.4.3 (#1, Aug 29 2011, 10:55:55) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.setlocale(locale.LC_ALL, ("cs_CZ", "utf-8"))
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib64/python2.4/locale.py", line 381, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting
>>> 


Version-Release number of selected component (if applicable):
python-2.4.3-44.el5_7.1.x86_64

How reproducible:
100%

Steps to Reproduce:
1.see above
2.
3.
  
Actual results:
backtrace

Expected results:
locale set, function returns the new locale label

Additional info:
There is a simple workaround. Check with locale -a what values can locale string get and then run classical string version of the call (for example)

locale.setlocale(locale.LC_ALL, "cs_CZ.utf8")

However, this call is completely system dependent (and doesn't work on other platforms).

Comment 2 RHEL Program Management 2013-03-15 04:25:34 UTC
Development Management has reviewed and declined this request.
You may appeal this decision by reopening this request.


Note You need to log in before you can comment on or make changes to this bug.