Fix peg_generator compiler warnings under MSVC#20405
Merged
pablogsal merged 1 commit intopython:masterfrom May 26, 2020
Merged
Conversation
|
🤖 New build scheduled with the buildbot fleet by @pablogsal for commit 7f546f8 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
Contributor
|
Thanks @ammaraskar for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
May 26, 2020
(cherry picked from commit a2bbedc) Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
|
GH-20408 is a backport of this pull request to the 3.9 branch. |
Member
|
Thank you very much for fixing these and for the detailed analysis 🚀 |
miss-islington
added a commit
that referenced
this pull request
May 26, 2020
(cherry picked from commit a2bbedc) Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes the following warnings:
The changes to
peg_extension.care pretty simple.For the tokenizer.c change, looking through the blame, it looks like
PyOS_Readlinewas extern'd so it could be included in both the old Cpgenexecutable and the interpreter:pgenin bpo-35808, we still used to link withtokenizer.oandmyreadline.o: https://github.com/python/cpython/blob/3.7/Makefile.pre.in#L311)Unfortunately right now this causes a warning due when building the
peg_generatormodule since it uses tokenizer.c as a source file. This causes a mismatch between the extern'dPyOS_Readlineand thePyAPI_FUNC'd version of the functions.Since we're building an extension, this causes pyport.h to set the function as a
__declspec(dllimport)which doesn't match the extern definition without the import declaration. See the page on the warning for more details: https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4273?view=vs-2019As far as I know, the only supported way of using tokenizer.c is with a Python runtime (since the
#ifndef PGENguards were removed) so this extern should be safe to remove now.