GH-149501: Fix compilation warning for _YIELD_VALUE#149502
Open
sergey-miryanov wants to merge 11 commits into
Open
GH-149501: Fix compilation warning for _YIELD_VALUE#149502sergey-miryanov wants to merge 11 commits into
sergey-miryanov wants to merge 11 commits into
Conversation
Contributor
Author
|
cc @vstinner as an author of the change |
f3eadda to
0cb3e7d
Compare
Member
|
Would it be possible to change i type to size_t or Py_ssize_t instead? |
sergey-miryanov
commented
May 8, 2026
vstinner
reviewed
May 11, 2026
Member
vstinner
left a comment
There was a problem hiding this comment.
Sorry, but in fact I prefer the initial fix: int i = (int)(frame->instr_ptr - _PyFrame_GetBytecode(frame));.
I don't think that changing _Py_GetBaseCodeUnit() parameter type from int to Py_ssize_t is worth it, since PyCode_New() checks indirectly that the size fits into an int:
if (PyBytes_GET_SIZE(con->code) > INT_MAX) {
PyErr_SetString(PyExc_OverflowError,
"code: co_code larger than INT_MAX");
return -1;
}This reverts commit 7938098.
Contributor
Author
|
@vstinner |
…nov/cpython into bug/149501-fix-msvc-warning
vstinner
reviewed
May 12, 2026
Member
vstinner
left a comment
There was a problem hiding this comment.
Yes, I'm fine with the assert() approach.
Co-authored-by: Victor Stinner <vstinner@python.org>
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.
Fix warning for MSVC