Skip to content

Issue #21: Avoid C++ keyword module #22

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 1 commit into from
Feb 11, 2022

Conversation

erlend-aasland
Copy link

@erlend-aasland erlend-aasland commented Feb 11, 2022

Rename module variable/argument names as mod.

Fixes #21

Copy link
Member

@corona10 corona10 left a comment

Choose a reason for hiding this comment

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

LGTM with easy solution but let's wait @vstinner 's review

@vstinner
Copy link
Member

Is it possible to detect the error using a C++ compiler warning to prevent adding new ones? The C++ compatibility is tested in tests/.

@erlend-aasland
Copy link
Author

Is it possible to detect the error using a C++ compiler warning to prevent adding new ones? The C++ compatibility is tested in tests/.

Good point. I'll add a test.

@vstinner
Copy link
Member

I guess that this PR is related to: https://bugs.python.org/issue39355

I don't get any warning:

$ cat x.cc 
int main() { int module = 1; return module; }
$ g++ -std=c++20 -Wall -Wextra x.cc -o x
# no warning

@vstinner vstinner merged commit ca6a60e into python:main Feb 11, 2022
@vstinner
Copy link
Member

I changed my mind. Python.h has the issue, so until Python will be fixed ( https://bugs.python.org/issue39355 https://bugs.python.org/issue39355 ) we cannot test it in pythoncapi_compat.h which includes Python.h. I don't want to add a test using a regex which would emit false alarm if the word "module" is used in a comment.

@vstinner
Copy link
Member

Thanks, I merged your fix!

@erlend-aasland
Copy link
Author

I changed my mind. Python.h has the issue, so until Python will be fixed ( https://bugs.python.org/issue39355 https://bugs.python.org/issue39355 ) we cannot test it in pythoncapi_compat.h which includes Python.h. I don't want to add a test using a regex which would emit false alarm if the word "module" is used in a comment.

Makes sense!

@erlend-aasland erlend-aasland deleted the cpp-keywords/module branch February 11, 2022 13:15
vstinner added a commit to vstinner/pythoncapi_compat that referenced this pull request Mar 29, 2022
vstinner added a commit that referenced this pull request Mar 29, 2022
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.

Avoid C++ keywords
3 participants