[Python-Dev] cygwin errors

Brett C. drifty@alum.berkeley.edu
Tue, 22 Jul 2003 13:56:04 -0700


Tim Peters wrote:

> [Brett C.]
> 
>>...
>>I can try to see what the problems are if someone can run::
>>
>> >>> import time
>> >>> time.strftime("%c")
>> >>> import _strptime
>> >>> _strptime.TimeRE()['c']
>>
>>after running test_logging to trigger the failure.
> 
> 
> There is no failure anymore, because Jermey added
> 
>     if cur_locale:
>         locale.setlocale(locale.LC_ALL, "C")
> 
> to the end of test_logging.py.  This almost certainly isn't a correct fix,
> though (test_logging should restore the locale to what it was before
> test_logging started just as a matter of cleaning up after itself, but it
> remains surprising that test_strptime fails if test_logging doesn't).  If
> you revert his change, then, e.g.,
> 
> C:\Code\python\PCbuild>python ../lib/test/regrtest.py test_logging
>                                                       test_strptime
> test_logging
> test_strptime
> test test_strptime failed -- Traceback (most recent call last):
>   File "C:\Code\python\lib\test\test_strptime.py", line 96, in test_lang
>     "Setting of lang failed")
>   File "C:\Code\python\lib\unittest.py", line 268, in failUnless
>     if not expr: raise self.failureException, msg
> AssertionError: Setting of lang failed
> 
> 1 test OK.
> 1 test failed:
>     test_strptime
> 
> C:\Code\python\PCbuild>
> 
> 
> At the point test_strptime fails, on my box the relevant expressions have
> the following values:
> 
> self.LT_ins.lang                  'English_United States'
> locale.getdefaultlocale()[0]      'en_US'
> locale.getlocale(locale.LC_TIME)  ['English_United States', '1252']
> 
> so
> 
>         self.failUnless(self.LT_ins.lang in (locale.getdefaultlocale()[0],
>                                          locale.getlocale(locale.LC_TIME),
>                                          ''),
>                         "Setting of lang failed")
> 
> fails.  It doesn't look like the test code expects
> 
>     locale.getlocale(locale.LC_TIME)
> 
> to return a list, but I don't know what's expected here ...
> 

Argh!  The test is wrong.  It should be 
locale.getlocale(locale.LC_TIME)[0] that is being checked against. 
Crap, sorry to have caused all of this trouble over such a stupid little 
mistake.  I am personally amazed it took so long for the error to show up.

I can check this minute change in, but what branch/tag/thing do you want 
it done to?

-Brett