Skip to content

gh-128152: Argument Clinic: don't parse CPP directives inside C comments #128464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 4, 2025

Conversation

erlend-aasland
Copy link
Contributor

@erlend-aasland erlend-aasland commented Jan 3, 2025

Resolves #128152

@erlend-aasland erlend-aasland requested a review from picnixz January 3, 2025 22:52
@erlend-aasland erlend-aasland changed the title clinic/empty comments gh-128152: Argument Clinic: don't parse CPP directives inside C comments Jan 3, 2025
@erlend-aasland erlend-aasland added needs backport to 3.12 only security fixes needs backport to 3.13 bugs and security fixes labels Jan 3, 2025
Copy link
Member

@picnixz picnixz left a comment

Choose a reason for hiding this comment

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

I'm not an expert in AC but this looks good. At least, I can now use empty lines in python input. By the way, I think I've just understood that CPP stands for Clinic Pre-Processor/Processing and not for C++....

@erlend-aasland
Copy link
Contributor Author

I can now use empty lines in python input

Yes, # prefixed lines are now correctly passed on as Python code. For clinic input blocks, they are correctly ignored as "Clinic comments":

def valid_line(self, line: str) -> bool:
# ignore comment-only lines
if line.lstrip().startswith('#'):
return False

@erlend-aasland
Copy link
Contributor Author

erlend-aasland commented Jan 3, 2025

Thanks for the quick review! I'll land this tomorrow.

@erlend-aasland erlend-aasland self-assigned this Jan 3, 2025
@erlend-aasland erlend-aasland merged commit a4e773c into python:main Jan 4, 2025
52 checks passed
@erlend-aasland erlend-aasland deleted the clinic/empty-comments branch January 4, 2025 10:46
@miss-islington-app

This comment was marked as outdated.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 4, 2025
…ide C comments (pythonGH-128464)

(cherry picked from commit a4e773c)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
@miss-islington-app

This comment was marked as outdated.

@bedevere-app
Copy link

bedevere-app bot commented Jan 4, 2025

GH-128478 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Jan 4, 2025
@erlend-aasland erlend-aasland removed the needs backport to 3.12 only security fixes label Jan 4, 2025
erlend-aasland added a commit that referenced this pull request Jan 4, 2025
…side C comments (GH-128464) (#128478)

(cherry picked from commit a4e773c)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull request Jan 6, 2025
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull request Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Argument Clinic's [python input] blocks do not support empty lines in comments
2 participants