[ python-Bugs-1039270 ] time zone tests fail on Windows

SourceForge.net noreply at sourceforge.net
Sun Oct 3 17:05:47 CEST 2004


Bugs item #1039270, was opened at 2004-10-03 12:44
Message generated for change (Comment added) made by quiver
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1039270&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: George Yoshida (quiver)
Assigned to: Brett Cannon (bcannon)
Summary: time zone tests fail on Windows

Initial Comment:
Following tests fail on Win 2K(Japanese locale):

# test_strptime.py
test_compile (__main__.TimeRETests) ... FAIL
test_bad_timezone (__main__.StrptimeTests) ... ERROR
test_timezone (__main__.StrptimeTests) ... ERROR
test_day_of_week_calculation 
(__main__.CalculationTests) ... ERROR
test_gregorian_calculation 
(__main__.CalculationTests) ... ERROR
test_julian_calculation (__main__.CalculationTests) ... 
ERROR

# test_time.py
test_strptime (test.test_time.TimeTestCase) ... FAIL
===
They all stem from time zone tests and can be divided 
into two groups:

FAIL of test_compile is basically same as #bug 883604.
 http://www.python.org/sf/883604
Local time values include regular expression's 
metacharacters, but they are not escaped.

The rest is caused because strptime can't parse the 
values of strftime.

>>> import time
>>> time.tzname
('\x93\x8c\x8b\x9e (\x95W\x8f\x80\x8e\x9e)', '\x93
\x8c\x8b\x9e (\x95W\x8f\x80\x8e\x9e)')
>>> time.strptime(time.strftime('%Z', time.gmtime()))

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in -toplevel-
    time.strptime(time.strftime('%Z', time.gmtime()))
  File "C:\Python24\lib\_strptime.py", line 291, in strptime
    raise ValueError("time data did not match format:  
data=%s  fmt=%s" %
ValueError: time data did not match format:  data=&#26481;&#20140; 
(&#27161;&#28310;&#26178;)  fmt=%a %b %d %H:%M:%S %Y

The output of running test_time.py and test_strptime.py 
is attached.

----------------------------------------------------------------------

>Comment By: George Yoshida (quiver)
Date: 2004-10-04 00:05

Message:
Logged In: YES 
user_id=671362

I've found another bug.
Line 167 & 169 of Lib/_strptime.py contains the expression:
 time.tzname[0].lower()

I guess this is intended to normalize alphabets, but for 
multibyte characters this is really dangerous.

>>> import time
>>> time.tzname[0]
'\x93\x8c\x8b\x9e (\x95W\x8f\x80\x8e\x9e)'
>>> _.lower()
'\x93\x8c\x8b\x9e (\x95w\x8f\x80\x8e\x9e)'

\x95W and \x95w is not the same character.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1039270&group_id=5470


More information about the Python-bugs-list mailing list