[Python-Dev] 2.1c1 "make test" failures on SGI Irix

Mark Favas m.favas@per.dem.csiro.au
Mon, 16 Apr 2001 11:02:51 +0800


Yes, the SGI appears not to return a grouping ([3, 0] is expected) for
the en_US locale (the rest of it looks OK).

However, there is still a bug in Lib/locale.py - the code currently
tries to allow for the possibility that an empty grouping may be
returned from localeconv() (and there must be some locales where this is
correct):

def _group(s):
    conv=localeconv()
    grouping=conv['grouping']
    if not grouping:return s

The code calling _group() assumes that the object returned will always
be a tuple, and hence the above will cause a traceback when localeconv()
returns an empty grouping. The correct code should be:

def _group(s):
    conv=localeconv()
    grouping=conv['grouping']
    if not grouping:return (s, 0)

test_locale will still fail on the SGI, but now because of a bug in the
platform implementation of the en_US locale, rather than a bug in the
Python locale.py code. It's better than a traceback.

BTW, mail to Martin doesn't seem to be getting through.

Guido van Rossum wrote:
> 
> > localeconv()['grouping'] is "[]" at this point...
> 
> It is looking like either the _locale.c module is not working right or
> the platform's implementation of the en_US locals is broken.  I'm
> afraid that only you will be able to make the determination. :-(
> 
> --Guido van Rossum (home page: http://www.python.org/~guido/)

-- 
Mark Favas  -   m.favas@per.dem.csiro.au
CSIRO, Private Bag No 5, Wembley, Western Australia 6913, AUSTRALIA