Skip to content

Commit e6f9e16

Browse files
committed
pythongh-119123: Fix sniffer to understand csv lists
1 parent 986c367 commit e6f9e16

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎Lib/csv.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,9 @@ def _guess_quote_and_delimiter(self, data, delimiters):
282282
"""
283283
import re
284284

285+
# Remove lists from the data, see issue 119123
286+
data = re.sub(r'\[.*?\]', '', data)
287+
285288
matches = []
286289
for restr in (r'(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?P=delim)', # ,".*?",
287290
r'(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?P<delim>[^\w\n"\'])(?P<space> ?)', # ".*?",

0 commit comments

Comments
 (0)