[Brett C.]
Either way we can do a quick check, Tim, if you can try out this patch::
Index: Lib/_strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/_strptime.py,v retrieving revision 1.21 diff -u -r1.21 _strptime.py --- Lib/_strptime.py 13 Jul 2003 01:31:38 -0000 1.21 +++ Lib/_strptime.py 22 Jul 2003 23:37:03 -0000 @@ -27,11 +27,11 @@
def _getlang(): # Figure out what the current language is set to. - current_lang = locale.getlocale(locale.LC_TIME)[0] + current_lang = locale.getlocale(locale.LC_TIME) if current_lang: return current_lang else: - current_lang = locale.getdefaultlocale()[0] + current_lang = locale.getdefaultlocale() if current_lang: return current_lang else:
Sorry, it didn't help: C:\Code\python\PCbuild>python ../lib/test/regrtest.py test_strptime test_logging test_time 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 test_logging test_time test test_time failed -- Traceback (most recent call last): File "C:\CODE\PYTHON\lib\test\test_time.py", line 49, in test_strptime self.fail('conversion specifier: %r failed.' % format) File "C:\CODE\PYTHON\lib\unittest.py", line 260, in fail raise self.failureException, msg AssertionError: conversion specifier: ' %c' failed. 1 test OK. 2 tests failed: test_strptime test_time C:\Code\python\PCbuild>
I should have been more explicit; I meant after *every* individual test and not after the battery of tests.
OK, and back to an unpatched _strptime.py. With the current CVS locale-restoration code (which differs from what it was half an hour ago, but should have the same effect): C:\Code\python\PCbuild>python ../lib/test/regrtest.py test_strptime test_logging test_time time.strftime("%c") '07/22/03 20:38:57' _strptime.TimeRE()['c'] '(?P<m>1[0-2]|0[1-9]|[1-9])/(?P<d>3[0-1]|[1-2]\\d|0[1-9]| [1-9]| [1-9])/(?P<y>\\d\\d)\\s*(?P<H>2[0-3]|[0-1]\\d|\\d) :(?P<M>[0-5]\\d|\\d):(?P<S>6[0-1]|[0-5]\\d|\\d)' locale.getdefaultlocale() ('en_US', 'cp1252') locale.getlocale(locale.LC_TIME) (None, None) test_strptime time.strftime("%c") '07/22/03 20:38:58' _strptime.TimeRE()['c'] '(?P<m>1[0-2]|0[1-9]|[1-9])/(?P<d>3[0-1]|[1-2]\\d|0[1-9]| [1-9]| [1-9])/(?P<y>\\d\\d)\\s*(?P<H>2[0-3]|[0-1]\\d|\\d) :(?P<M>[0-5]\\d|\\d):(?P<S>6[0-1]|[0-5]\\d|\\d)' locale.getdefaultlocale() ('en_US', 'cp1252') locale.getlocale(locale.LC_TIME) (None, None) test_logging time.strftime("%c") '07/22/03 20:38:59' _strptime.TimeRE()['c'] '(?P<m>1[0-2]|0[1-9]|[1-9])/(?P<d>3[0-1]|[1-2]\\d|0[1-9]| [1-9]| [1-9])/(?P<y>\\d\\d)\\s*(?P<H>2[0-3]|[0-1]\\d|\\d) :(?P<M>[0-5]\\d|\\d):(?P<S>6[0-1]|[0-5]\\d|\\d)' locale.getdefaultlocale() ('en_US', 'cp1252') locale.getlocale(locale.LC_TIME) (None, None) test_time time.strftime("%c") '07/22/03 20:39:01' _strptime.TimeRE()['c'] '(?P<m>1[0-2]|0[1-9]|[1-9])/(?P<d>3[0-1]|[1-2]\\d|0[1-9]| [1-9]| [1-9])/(?P<y>\\d\\d)\\s*(?P<H>2[0-3]|[0-1]\\d|\\d) :(?P<M>[0-5]\\d|\\d):(?P<S>6[0-1]|[0-5]\\d|\\d)' locale.getdefaultlocale() ('en_US', 'cp1252') locale.getlocale(locale.LC_TIME) (None, None) All 3 tests OK. Again, without restoring locale in test_logging: C:\Code\python\PCbuild>python ../lib/test/regrtest.py test_strptime test_logging test_time time.strftime("%c") '07/22/03 20:39:09' _strptime.TimeRE()['c'] '(?P<m>1[0-2]|0[1-9]|[1-9])/(?P<d>3[0-1]|[1-2]\\d|0[1-9]| [1-9]| [1-9])/(?P<y>\\d\\d)\\s*(?P<H>2[0-3]|[0-1]\\d|\\d) :(?P<M>[0-5]\\d|\\d):(?P<S>6[0-1]|[0-5]\\d|\\d)' locale.getdefaultlocale() ('en_US', 'cp1252') locale.getlocale(locale.LC_TIME) (None, None) test_strptime time.strftime("%c") '07/22/03 20:39:10' _strptime.TimeRE()['c'] '(?P<m>1[0-2]|0[1-9]|[1-9])/(?P<d>3[0-1]|[1-2]\\d|0[1-9]| [1-9]| [1-9])/(?P<y>\\d\\d)\\s*(?P<H>2[0-3]|[0-1]\\d|\\d) :(?P<M>[0-5]\\d|\\d):(?P<S>6[0-1]|[0-5]\\d|\\d)' locale.getdefaultlocale() ('en_US', 'cp1252') locale.getlocale(locale.LC_TIME) (None, None) test_logging time.strftime("%c") '07/22/2003 08:39:11 PM' _strptime.TimeRE()['c'] '(?P<m>1[0-2]|0[1-9]|[1-9])/(?P<d>3[0-1]|[1-2]\\d|0[1-9]| [1-9]| [1-9])/(?P<y>\\d\\d)\\s*(?P<H>2[0-3]|[0-1]\\d|\\d) :(?P<M>[0-5]\\d|\\d):(?P<S>6[0-1]|[0-5]\\d|\\d)' locale.getdefaultlocale() ('en_US', 'cp1252') locale.getlocale(locale.LC_TIME) ['English_United States', '1252'] test_time test test_time failed -- Traceback (most recent call last): File "C:\CODE\PYTHON\lib\test\test_time.py", line 49, in test_strptime self.fail('conversion specifier: %r failed.' % format) File "C:\CODE\PYTHON\lib\unittest.py", line 260, in fail raise self.failureException, msg AssertionError: conversion specifier: ' %c' failed. time.strftime("%c") '07/22/2003 08:39:13 PM' _strptime.TimeRE()['c'] '(?P<m>1[0-2]|0[1-9]|[1-9])/(?P<d>3[0-1]|[1-2]\\d|0[1-9]| [1-9]| [1-9])/(?P<y>\\d\\d)\\s*(?P<H>2[0-3]|[0-1]\\d|\\d) :(?P<M>[0-5]\\d|\\d):(?P<S>6[0-1]|[0-5]\\d|\\d)' locale.getdefaultlocale() ('en_US', 'cp1252') locale.getlocale(locale.LC_TIME) ['English_United States', '1252'] 2 tests OK. 1 test failed: test_time C:\Code\python\PCbuild>