From: Brett Cannon Date: Wed, 6 Oct 2004 22:48:58 +0000 (+0000) Subject: Fix bug introduced by the previous patch by changing TimeRE.__seqToRe() to X-Git-Tag: v2.4b1~85 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ffa5cf9eae5fff1e46e8962cd957fd2ffe5a77cb;p=python Fix bug introduced by the previous patch by changing TimeRE.__seqToRe() to accept any iterable instead of only a sliceable object. --- diff --git a/Lib/_strptime.py b/Lib/_strptime.py index 530057031e..17460ce980 100644 --- a/Lib/_strptime.py +++ b/Lib/_strptime.py @@ -226,13 +226,12 @@ class TimeRE(dict): matching when 'abcdef' should have been the match). """ + to_convert = sorted(to_convert, key=len, reverse=True) for value in to_convert: if value != '': break else: return '' - to_convert = to_convert[:] - to_convert.sort(key=len, reverse=True) regex = '|'.join(re_escape(stuff) for stuff in to_convert) regex = '(?P<%s>%s' % (directive, regex) return '%s)' % regex