Skip to content

Commit 9188925

Browse files
committed
fix review idea
Signed-off-by: Manjusaka <[email protected]>
1 parent f8483c1 commit 9188925

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

Lib/test/test_capi/test_opt.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2167,6 +2167,7 @@ def testfunc(n):
21672167
self.assertIsNotNone(ex)
21682168
uops = get_opnames(ex)
21692169
self.assertNotIn("_LOAD_SMALL_INT", uops)
2170+
self.assertIn("_LOAD_CONST_INLINE_BORROW", uops)
21702171

21712172
def global_identity(x):
21722173
return x

Python/optimizer_bytecodes.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,9 @@ dummy_func(void) {
528528
}
529529

530530
op(_LOAD_SMALL_INT, (-- value)) {
531-
PyObject *val = PyLong_FromLong(this_instr->oparg);
531+
PyObject *val = PyLong_FromLong(oparg);
532+
assert(val);
533+
assert(_Py_IsImmortal(val));
532534
REPLACE_OP(this_instr, _LOAD_CONST_INLINE_BORROW, 0, (uintptr_t)val);
533535
value = sym_new_const(ctx, val);
534536
}

Python/optimizer_cases.c.h

Lines changed: 3 additions & 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)