Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add some explicit casts to int.
  • Loading branch information
ericsnowcurrently committed Jun 7, 2021
commit cd2508faceec7721d70110943912c50a0f811590
5 changes: 3 additions & 2 deletions Python/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -7399,15 +7399,16 @@ insert_prefix_instructions(struct compiler *c, basicblock *entryblock) {
PyObject *k, *v;
Py_ssize_t pos = 0;
while (PyDict_Next(c->u->u_cellvars, &pos, &k, &v)) {
Py_ssize_t cellindex = PyLong_AS_LONG(v);
assert(PyLong_AS_LONG(v) < INT_MAX);
int cellindex = (int)PyLong_AS_LONG(v);
struct instr make_cell = {
.i_opcode = MAKE_CELL,
// This will get fixed in offset_derefs().
.i_oparg = cellindex,
.i_lineno = -1,
.i_target = NULL,
};
if (insert_instruction(entryblock, pos - 1, &make_cell) < 0) {
if (insert_instruction(entryblock, (int)(pos - 1), &make_cell) < 0) {
return -1;
}
}
Expand Down