Skip to content

Commit 98b517d

Browse files
committed
Address review comments
1 parent d2af12f commit 98b517d

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

Python/optimizer.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
#define MAX_EXECUTORS_SIZE 256
2525

2626
#ifdef Py_DEBUG
27-
static int base_opcode(PyCodeObject *code, int offset)
27+
static int
28+
base_opcode(PyCodeObject *code, int offset)
2829
{
2930
int opcode = _Py_GetBaseOpcode(code, offset);
3031
if (opcode == ENTER_EXECUTOR) {
@@ -788,11 +789,13 @@ translate_bytecode_to_trace(
788789
uop = _PyUOp_Replacements[uop];
789790
assert(uop != 0);
790791
#ifdef Py_DEBUG
791-
uint32_t next_inst = target + 1 + INLINE_CACHE_ENTRIES_FOR_ITER + (oparg > 255);
792-
uint32_t jump_target = next_inst + oparg;
793-
assert(base_opcode(code, jump_target) == END_FOR ||
794-
base_opcode(code, jump_target) == INSTRUMENTED_END_FOR);
795-
assert(base_opcode(code, jump_target+1) == POP_TOP);
792+
{
793+
uint32_t next_inst = target + 1 + INLINE_CACHE_ENTRIES_FOR_ITER + (oparg > 255);
794+
uint32_t jump_target = next_inst + oparg;
795+
assert(base_opcode(code, jump_target) == END_FOR ||
796+
base_opcode(code, jump_target) == INSTRUMENTED_END_FOR);
797+
assert(base_opcode(code, jump_target+1) == POP_TOP);
798+
}
796799
#endif
797800
break;
798801
default:

Python/optimizer_symbols.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,12 @@ _Py_uop_sym_set_null(_Py_UopsSymbol *sym)
178178
bool
179179
_Py_uop_sym_set_non_null(_Py_UopsSymbol *sym)
180180
{
181+
if (_Py_uop_sym_is_null(sym)) {
182+
sym_set_bottom(sym);
183+
return false;
184+
}
181185
sym_set_flag(sym, NOT_NULL);
182-
return !_Py_uop_sym_is_bottom(sym);
186+
return true;
183187
}
184188

185189

0 commit comments

Comments
 (0)