Package: python2.3
Version: 2.3.5-6
Severity: important
When using locale.strcoll to do locale dependant sorting the result is
randomly different when trying so sort the same dataset multiple times.
See the following test script:
import locale
for l in ('C','de_DE','ru_RU'):
locale.setlocale(locale.LC_ALL, l)
print locale.getlocale()
a = [u'?',u'xx', u'aa', u'.', u'BB', u'']
for n in range(5):
a.sort(locale.strcoll)
print a
print "-"
for n in range(5):
a = [u'?',u'xx', u'aa', u'.', u'BB', u'']
a.sort(locale.strcoll)
print a
print "#######"
It is expected that it prints always 5 lines in which the order of
elements is equal because a list of different items sould always be
ordered in the same way.
When using python2.3 the result is:
(None, None)
[u'.', u'?', u'BB', u'aa', u'xx', u'']
[u'.', u'?', u'BB', u'aa', u'xx', u'']
[u'.', u'?', u'BB', u'aa', u'xx', u'']
[u'.', u'?', u'BB', u'aa', u'xx', u'']
[u'.', u'?', u'BB', u'aa', u'xx', u'']
-
[u'.', u'?', u'BB', u'aa', u'xx', u'']
[u'.', u'?', u'BB', u'aa', u'xx', u'']
[u'.', u'?', u'BB', u'aa', u'xx', u'']
[u'.', u'?', u'BB', u'aa', u'xx', u'']
[u'.', u'?', u'BB', u'aa', u'xx', u'']
#######
['de_DE', 'ISO8859-1']
[u'.', u'?', u'aa', u'BB', u'', u'xx']
[u'aa', u'?', u'.', u'', u'BB', u'xx']
[u'aa', u'', u'?', u'.', u'BB', u'xx']
[u'aa', u'', u'?', u'.', u'BB', u'xx']
[u'aa', u'', u'?', u'.', u'BB', u'xx']
-
[u'?', u'.', u'aa', u'BB', u'', u'xx']
[u'.', u'?', u'aa', u'BB', u'', u'xx']
[u'?', u'.', u'aa', u'BB', u'', u'xx']
[u'.', u'?', u'aa', u'BB', u'', u'xx']
[u'?', u'.', u'aa', u'BB', u'', u'xx']
#######
['ru_RU', 'ISO8859-5']
[u'?', u'.', u'aa', u'BB', u'', u'xx']
[u'aa', u'BB', u'', u'.', u'?', u'xx']
[u'aa', u'.', u'?', u'', u'BB', u'xx']
[u'aa', u'', u'.', u'BB', u'?', u'xx']
[u'aa', u'BB', u'?', u'', u'.', u'xx']
-
[u'?', u'.', u'aa', u'BB', u'', u'xx']
[u'aa', u'?', u'.', u'BB', u'', u'xx']
[u'?', u'.', u'aa', u'BB', u'', u'xx']
[u'aa', u'?', u'.', u'BB', u'', u'xx']
[u'?', u'.', u'aa', u'BB', u'', u'xx']
As you can see for german and russian locale the result of
a.sort(locale.strcoll) differs each time it is used.
It only happens when certain strings are to be sorted. For example an
empty string u'' or the question mark u'?' cause the sorting to be buggy.
When using only letters (a-z) all is fine.
It has been reproduced on 3 different debian installations.
It works fine when using python2.2 or python2.4.
This bug causes other python applications to behave incorrectly. For example
in the genealogy program "gramps" the alphabetical order of
persons is sometimes different/incorrect.
Cheers,
Martin.
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.4.27-2-686-smp
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)
Versions of packages python2.3 depends on:
ii libbz2-1.0 1.0.2-8 high-quality block-sorting file
co
ii libc6 2.3.2.ds1-22 GNU C Library: Shared libraries
an
ii libdb4.3 4.3.28-2 Berkeley v4.3 Database
Libraries [
ii libncurses5 5.4-9 Shared libraries for terminal
hand
ii libreadline5 5.0-10 GNU readline and history
libraries
ii libssl0.9.7 0.9.7g-1 SSL shared libraries
ii zlib1g 1:1.2.3-1 compression library - runtime
Versions of packages python2.3 recommends:
pn python2.3-cjkcodecs | python2 <none> (no description available)
pn python2.3-cjkcodecs | python2 <none> (no description available)
-- no debconf information
--
GMX DSL = Maximale Leistung zum minimalen Preis!
2000 MB nur 2,99, Flatrate ab 4,99 Euro/Monat: http://www.gmx.net/de/go/dsl
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]