Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ffa5cf9

Browse files
committed
Fix bug introduced by the previous patch by changing TimeRE.__seqToRe() to
accept any iterable instead of only a sliceable object.
1 parent c5fa992 commit ffa5cf9

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

Lib/_strptime.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,12 @@ def __seqToRE(self, to_convert, directive):
226226
matching when 'abcdef' should have been the match).
227227
228228
"""
229+
to_convert = sorted(to_convert, key=len, reverse=True)
229230
for value in to_convert:
230231
if value != '':
231232
break
232233
else:
233234
return ''
234-
to_convert = to_convert[:]
235-
to_convert.sort(key=len, reverse=True)
236235
regex = '|'.join(re_escape(stuff) for stuff in to_convert)
237236
regex = '(?P<%s>%s' % (directive, regex)
238237
return '%s)' % regex

0 commit comments

Comments
 (0)