Skip to content

Commit bd808da

Browse files
committed
1 parent 4f4ea45 commit bd808da

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎Lib/csv.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,10 @@ def _guess_quote_and_delimiter(self, data, delimiters):
221221
"""
222222

223223
matches = []
224-
for restr in (r'(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?P=delim)', # ,".*?",
225-
r'(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?P<delim>[^\w\n"\'])(?P<space> ?)', # ".*?",
226-
r'(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?:$|\r|\n)', # ,".*?"
227-
r'(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?:$|\r|\n)'): # ".*?" (no delim, no space)
224+
for restr in (r'(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?P=delim)', # ,".*?",
225+
r'(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?P<delim>[^\w\n"\'])(?P<space> ?)', # ".*?",
226+
r'(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?:$|\r|\n)', # ,".*?"
227+
r'(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?:$|\r|\n)'): # ".*?" (no delim, no space)
228228
regexp = re.compile(restr, re.DOTALL | re.MULTILINE)
229229
matches = regexp.findall(data)
230230
if matches:

‎Lib/test/test_csv.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1189,7 +1189,7 @@ class TestSniffer(unittest.TestCase):
11891189
ghijkl\0mno
11901190
ghi\0jkl
11911191
"""
1192-
sample15 = 'Timestamp,URL,Title\r\n2020-10-01 17:17:37+08:00,https://www.mozilla.org/en-US/firefox/welcome/2/,"Pocket - Save news, videos, stories and more"\r\n'
1192+
sample15 = 'time,title\r\n2020-10-01,"Pocket - Save news, videos, stories and more"\r\n'
11931193

11941194

11951195
def test_issue43625(self):

0 commit comments

Comments
 (0)