diff options
author | Brett Cannon <bcannon@gmail.com> | 2003-07-03 19:59:57 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2003-07-03 19:59:57 (GMT) |
commit | cde2200ff28a0a54a1dc62e6a63ca3936fee5177 (patch) | |
tree | 569f3472a7ee2c87c04d66442d6e9f3dd89d5a90 /Lib/_strptime.py | |
parent | ebab26a70950f61b9c342b526b271aac36e1576e (diff) | |
download | cpython-cde2200ff28a0a54a1dc62e6a63ca3936fee5177.zip cpython-cde2200ff28a0a54a1dc62e6a63ca3936fee5177.tar.gz cpython-cde2200ff28a0a54a1dc62e6a63ca3936fee5177.tar.bz2 |
Fixes bug of timezone value being left as -1 when ``time.tzname[0] ==
time.tzname[1] and not time.daylight`` is true when it should only when
time.daylight is true. Tests are also fixed.
Closes bug #763047 and its cohort #763052.
Diffstat (limited to 'Lib/_strptime.py')
-rw-r--r-- | Lib/_strptime.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/_strptime.py b/Lib/_strptime.py index dcc447b..ba9dde0 100644 --- a/Lib/_strptime.py +++ b/Lib/_strptime.py @@ -501,16 +501,17 @@ def strptime(data_string, format="%a %b %d %H:%M:%S %Y"): # Since -1 is default value only need to worry about setting tz if # it can be something other than -1. found_zone = found_dict['Z'].lower() - if locale_time.timezone[0] == locale_time.timezone[1]: + if locale_time.timezone[0] == locale_time.timezone[1] and \ + time.daylight: pass #Deals with bad locale setup where timezone info is # the same; first found on FreeBSD 4.4. elif found_zone in ("utc", "gmt"): tz = 0 elif locale_time.timezone[2].lower() == found_zone: tz = 0 - elif time.daylight: - if locale_time.timezone[3].lower() == found_zone: - tz = 1 + elif time.daylight and \ + locale_time.timezone[3].lower() == found_zone: + tz = 1 # Cannot pre-calculate datetime_date() since can change in Julian #calculation and thus could have different value for the day of the week |