Skip to content

gh-103925: csv.py _guess_quote_and_delimiter should be able to handle windows \r#103926

Open
lilaboc wants to merge 6 commits into
python:mainfrom
lilaboc:fix-issue-103925
Open

gh-103925: csv.py _guess_quote_and_delimiter should be able to handle windows \r#103926
lilaboc wants to merge 6 commits into
python:mainfrom
lilaboc:fix-issue-103925

Conversation

@lilaboc

@lilaboc lilaboc commented Apr 27, 2023

Copy link
Copy Markdown

@bedevere-bot

Copy link
Copy Markdown

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

@ghost

ghost commented Apr 27, 2023

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.
CLA signed

Comment thread Lib/csv.py Outdated
r'(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?P<delim>[^\w\n"\'])(?P<space> ?)', # ".*?",
r'(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?:$|\n)', # ,".*?"
r'(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?:$|\n)'): # ".*?" (no delim, no space)
for restr in (r'(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?P=delim)', # ,".*?",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the space rule here is to "align the comments but make the lines as short as possible", which basically means align to the longest line. Now with your change, the third line becomes the longest, so you should probably leave one space between the comment and the code on the third line, and align with that. (one extra space on the other lines if I counted correctly)

@lilaboc lilaboc Apr 27, 2023

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PEP 8: E261 at least two spaces before inline comment
I made another commit to use 2 spaces for now

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, two definitely works. The original code uses a single space, probably because the line was long. But two is good for me.

Comment thread Lib/test/test_csv.py Outdated
Comment thread Misc/NEWS.d/next/Library/2023-04-27-14-50-03.gh-issue-103925.khC-El.rst Outdated
@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review stale Stale PR or inactive for long period of time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants