Skip to content

Commit c2a3522

Browse files
committed
Converting zero-length lookahead assertions to atomic group
1 parent 2b29051 commit c2a3522

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

Lib/csv.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,8 @@ def _guess_quote_and_delimiter(self, data, delimiters):
270270

271271
# if we see an extra quote between delimiters, we've got a
272272
# double quoted format
273-
# in future Python versions this zero width look-ahead assert can be replaced with atomic groups
274273
dq_regexp = re.compile(
275-
r"((%(delim)s)|^)\W*%(quote)s(?=(?P<zero>[^%(delim)s%(quote)s\n]*))(?P=zero)%(quote)s[^%(delim)s\n]*%(quote)s\W*((%(delim)s)|$)" % \
274+
r"((%(delim)s)|^)\W*%(quote)s(?>[^%(delim)s%(quote)s\n]*)%(quote)s[^%(delim)s\n]*%(quote)s\W*((%(delim)s)|$)" % \
276275
{'delim':re.escape(delim), 'quote':quotechar}, re.MULTILINE)
277276

278277

0 commit comments

Comments
 (0)