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

bpo-40941: Fix fold_tuple_on_constants() compiler warnings by vstinner · Pull Request #22378 · python/cpython · GitHub

/ cpython Public
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
6 changes: 2 additions & 4 deletions Python/compile.c
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
Original file line number Diff line number Diff line change
Expand Up @@ -6100,13 +6100,11 @@ fold_tuple_on_constants(struct instr *inst,
PyTuple_SET_ITEM(newconst, i, constant);
}
Py_ssize_t index = PyList_GET_SIZE(consts);
#if SIZEOF_SIZE_T > SIZEOF_INT
if ((size_t)index >= UINT_MAX - 1) {
if ((size_t)index >= (size_t)INT_MAX - 1) {
Py_DECREF(newconst);
PyErr_SetString(PyExc_OverflowError, "too many constants");
return -1;
}
#endif
if (PyList_Append(consts, newconst)) {
Py_DECREF(newconst);
return -1;
Expand All @@ -6116,7 +6114,7 @@ fold_tuple_on_constants(struct instr *inst,
inst[i].i_opcode = NOP;
}
inst[n].i_opcode = LOAD_CONST;
inst[n].i_oparg = index;
inst[n].i_oparg = (int)index;
return 0;
}

Expand Down

Back | FazBrowse Home | New Git URL