]> granicus.if.org Git - python/commitdiff
Fix bug introduced by the previous patch by changing TimeRE.__seqToRe() to
authorBrett Cannon <bcannon@gmail.com>
Wed, 6 Oct 2004 22:48:58 +0000 (22:48 +0000)
committerBrett Cannon <bcannon@gmail.com>
Wed, 6 Oct 2004 22:48:58 +0000 (22:48 +0000)
accept any iterable instead of only a sliceable object.

Lib/_strptime.py

index 530057031e60ca3343cbc5749aa18dd609d81715..17460ce98090723eebfd8607f7b818ecba856b95 100644 (file)
@@ -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