This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pnugues
Recipients ezio.melotti, pnugues, vstinner
Date 2015-01-08.20:30:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1420749056.81.0.378421650447.issue23195@psf.upfronthosting.co.za>
In-reply-to
Content
The sorted() function does not work properly with macosx.
Here is a script to reproduce the issue:

import locale
locale.setlocale(locale.LC_ALL, "fr_FR.UTF-8")
a = ["A", "E", "Z", "a", "e", "é", "z"]
sorted(a)
sorted(a, key=locale.strxfrm)


The execution on MacOsX produces:
pierre:Flaubert pierre$ sw_vers -productVersion
10.10.1
pierre:Flaubert pierre$ python3
Python 3.4.2 (v3.4.2:ab2c023a9432, Oct  5 2014, 20:42:22) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import locale
locale.setlocale(locale.LC_ALL, "fr_FR.UTF-8")
'fr_FR.UTF-8'
a = ["A", "E", "Z", "a", "e", "é", "z"]
sorted(a)
['A', 'E', 'Z', 'a', 'e', 'z', 'é']
sorted(a, key=locale.strxfrm)
['A', 'E', 'Z', 'a', 'e', 'z', 'é']


while it produces this on your interactive shell (python.org):
In [10]: import locale
In [11]: locale.setlocale(locale.LC_ALL, "fr_FR.UTF-8")
Out[11]: 'fr_FR.UTF-8'
In [12]: a = ["A", "E", "Z", "a", "e", "é", "z"]
In [13]: sorted(a)
Out[13]: ['A', 'E', 'Z', 'a', 'e', 'z', 'é']
In [14]: sorted(a, key=locale.strxfrm)
Out[14]: ['a', 'A', 'e', 'E', 'é', 'z', 'Z']

which is correct.
History
Date User Action Args
2015-01-08 20:30:56pnuguessetrecipients: + pnugues, vstinner, ezio.melotti
2015-01-08 20:30:56pnuguessetmessageid: <1420749056.81.0.378421650447.issue23195@psf.upfronthosting.co.za>
2015-01-08 20:30:56pnugueslinkissue23195 messages
2015-01-08 20:30:56pnuguescreate