summaryrefslogtreecommitdiff
path: root/Lib/_strptime.py
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2017-07-12 11:05:23 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2017-07-12 11:05:31 +0900
commitcd850db82fbac76771227dd7cf7e2d7b1f39ef96 (patch)
tree374c3ece296ab248cb14abb1be7e7ae6fb228f85 /Lib/_strptime.py
parentd9ee28364c29c1cf64c3291e4e0f920309bc9731 (diff)
downloadpython-cd850db82fbac76771227dd7cf7e2d7b1f39ef96.tar.gz
python-cd850db82fbac76771227dd7cf7e2d7b1f39ef96.tar.bz2
python-cd850db82fbac76771227dd7cf7e2d7b1f39ef96.zip
Imported Upstream version 2.7.10upstream/2.7.10
Change-Id: I71e04a6e83b31198e3aff21913814359e60b7843 Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'Lib/_strptime.py')
-rw-r--r--Lib/_strptime.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/_strptime.py b/Lib/_strptime.py
index 042db6f..1bd570d 100644
--- a/Lib/_strptime.py
+++ b/Lib/_strptime.py
@@ -335,9 +335,9 @@ def _strptime(data_string, format="%a %b %d %H:%M:%S %Y"):
# though
week_of_year = -1
week_of_year_start = -1
- # weekday and julian defaulted to -1 so as to signal need to calculate
+ # weekday and julian defaulted to None so as to signal need to calculate
# values
- weekday = julian = -1
+ weekday = julian = None
found_dict = found.groupdict()
for group_key in found_dict.iterkeys():
# Directives not explicitly handled below:
@@ -434,14 +434,14 @@ def _strptime(data_string, format="%a %b %d %H:%M:%S %Y"):
year = 1900
# If we know the week of the year and what day of that week, we can figure
# out the Julian day of the year.
- if julian == -1 and week_of_year != -1 and weekday != -1:
+ if julian is None and week_of_year != -1 and weekday is not None:
week_starts_Mon = True if week_of_year_start == 0 else False
julian = _calc_julian_from_U_or_W(year, week_of_year, weekday,
week_starts_Mon)
# Cannot pre-calculate datetime_date() since can change in Julian
# calculation and thus could have different value for the day of the week
# calculation.
- if julian == -1:
+ if julian is None:
# Need to add 1 to result since first day of the year is 1, not 0.
julian = datetime_date(year, month, day).toordinal() - \
datetime_date(year, 1, 1).toordinal() + 1
@@ -451,7 +451,7 @@ def _strptime(data_string, format="%a %b %d %H:%M:%S %Y"):
year = datetime_result.year
month = datetime_result.month
day = datetime_result.day
- if weekday == -1:
+ if weekday is None:
weekday = datetime_date(year, month, day).weekday()
if leap_year_fix:
# the caller didn't supply a year but asked for Feb 29th. We couldn't