FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-39943: Fix MSVC warnings in sre extension by ammaraskar · Pull Request #20508 · python/cpython · GitHub

Repository navigation

bpo-39943: Fix MSVC warnings in sre extension - #20508

Merged
vstinner merged 1 commit into
python:masterfrom
ammaraskar:sre_msvc_warnings
Jun 1, 2020
Merged

vstinner merged 1 commit into
python:masterfrom
ammaraskar:sre_msvc_warnings

Conversation

ammaraskar commented May 29, 2020 •
edited
Loading

Copy link
Copy Markdown
Member

While the PyMem_Del change seems harmless enough, I'm a little bit uneasy about the memcpy one. This file is pretty old and unlikely to change in the future but it seems like it opens up the possibility of someone making a mistake like DATA_STACK_POP(state, 5, ...) and have it not caught by the type checker because of the explicit cast.

For that particular one we could guard the explicitly casted version with #ifdef _MSC_VER or something so it's harder to make that mistake and not have it be caught by the CI.

https://bugs.python.org/issue39943

Copy link
Copy Markdown
Member Author

@petdance Your review here would be appreciated as well.

Comment thread Modules/sre_lib.h Outdated

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'm not sure that it's ok to put a comment into a #define macro. Maybe convert the macro to a static inline function, or put the comment outside (before) the #define.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Good point, this works but it might lead to weird situations like

/*
  some_commented_out_code();
  MACRO;
*/

and then the comment suddenly gets stopped in the middle due to macro expansion.

ammaraskar force-pushed the sre_msvc_warnings branch from e021e49 to 0f5ec74 Compare May 29, 2020 18:27
ammaraskar force-pushed the sre_msvc_warnings branch from 0f5ec74 to e9d75be Compare May 29, 2020 18:28

Copy link
Copy Markdown
Contributor

Looks fine to me. Good catch on the comments-in-a-macro.

vstinner commented Jun 1, 2020

Copy link
Copy Markdown
Member

I checked Windows x64 job and I confirm that this PR fix all compiler warnings in sre files.

Copy link
Copy Markdown
Contributor

Thanks @ammaraskar for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9.
🐍🍒⛏🤖

Copy link
Copy Markdown

GH-24856 is a backport of this pull request to the 3.9 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 14, 2021
(cherry picked from commit 06e3a27)

Co-authored-by: Ammar Askar <ammar@ammaraskar.com>

Copy link
Copy Markdown
Member

It needs to be backpoted to 3.9.

miss-islington added a commit that referenced this pull request Mar 14, 2021
(cherry picked from commit 06e3a27)

Co-authored-by: Ammar Askar <ammar@ammaraskar.com>

serhiy-storchaka commented Mar 16, 2021 •
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member

See also bpo-43499.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants


Back | FazBrowse Home | New Git URL