Bug 758937

Summary: locale.setlocale doesn't allow setting tuple
Product: Red Hat Enterprise Linux 5 Reporter: Matěj Cepl <mcepl>
Component: pythonAssignee: Dave Malcolm <dmalcolm>
Status: CLOSED WONTFIX QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: low Docs Contact:
Priority: unspecified    
Version: 5.8CC: katzj
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-03-15 04:25:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

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.