Skip to content

Commit f135b69

Browse files
committed
Address review comments
1 parent f934559 commit f135b69

File tree

6 files changed

+9
-11
lines changed

6 files changed

+9
-11
lines changed

Python/bytecodes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ dummy_func(
272272
replicate(4) inst(LOAD_INT, (-- value)) {
273273
/* Tell code generator that this is a const load */
274274
(void)FRAME_CO_CONSTS;
275-
assert(oparg < 256);
275+
assert(oparg < _PY_NSMALLPOSINTS);
276276
PyObject *obj = (PyObject *)&_PyLong_SMALL_INTS[_PY_NSMALLNEGINTS + oparg];
277277
value = PyStackRef_FromPyObjectImmortal(obj);
278278
}

Python/codegen.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ codegen_addop_load_const(compiler *c, location loc, PyObject *o)
283283
if (PyLong_CheckExact(o)) {
284284
int overflow;
285285
long val = PyLong_AsLongAndOverflow(o, &overflow);
286-
if (!overflow && val >= 0 && val < 256) {
286+
if (!overflow && val >= 0 && val < 256 && val < _PY_NSMALLPOSINTS) {
287287
ADDOP_I(c, loc, LOAD_INT, val);
288288
return SUCCESS;
289289
}

Python/compile.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,6 @@ _PyCompile_DictAddObj(PyObject *dict, PyObject *o)
447447
Py_ssize_t
448448
_PyCompile_AddConst(compiler *c, PyObject *o)
449449
{
450-
451-
452450
PyObject *key = merge_consts_recursive(c->c_const_cache, o);
453451
if (key == NULL) {
454452
return ERROR;

Python/executor_cases.c.h

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/flowgraph.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ dump_instr(cfg_instr *i)
283283
static inline int
284284
basicblock_returns(const basicblock *b) {
285285
cfg_instr *last = basicblock_last_instr(b);
286-
return last && last->i_opcode == RETURN_VALUE);
286+
return last && last->i_opcode == RETURN_VALUE;
287287
}
288288

289289
static void

Python/generated_cases.c.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)