GH-149501: Fix compilation warning for _YIELD_VALUE#149502
Conversation
|
cc @vstinner as an author of the change |
f3eadda to
0cb3e7d
Compare
|
Would it be possible to change i type to size_t or Py_ssize_t instead? |
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.
|
@vstinner |
…nov/cpython into bug/149501-fix-msvc-warning
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>
|
JIT fail seems unrelated to the changes. |
|
Thanks all! |
|
Thanks @sergey-miryanov for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15. |
|
GH-149737 is a backport of this pull request to the 3.15 branch. |
Fix warning for MSVC