From d6dbf394a28592bb0571a6521f3f312959fe82d6 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Sat, 27 Aug 2005 19:29:21 +0000 Subject: Fix bug where __contains__ should have been used over str.find() --- Lib/_strptime.py | 2 +- Misc/NEWS | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Lib/_strptime.py b/Lib/_strptime.py index a6b54f3..aa02ba1 100644 --- a/Lib/_strptime.py +++ b/Lib/_strptime.py @@ -148,7 +148,7 @@ class LocaleTime(object): if old: current_format = current_format.replace(old, new) time_tuple = time.struct_time((1999,1,3,1,1,1,6,3,0)) - if time.strftime(directive, time_tuple).find('00'): + if '00' in time.strftime(directive, time_tuple): U_W = '%U' else: U_W = '%W' diff --git a/Misc/NEWS b/Misc/NEWS index 9ea848b..9d22ee5 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -79,6 +79,9 @@ Extension Modules Library ------- +- Fix a misuse of str.find() in detection of use of %U or %W in datetime + format. + - Bug #1167128: Fix size of a symlink in a tarfile to be 0. - Patch #810023: Fix off-by-one bug in urllib.urlretrieve reporthook -- cgit v0.12