diff --git a/ASTree.cpp b/ASTree.cpp index 108e4e4..8776265 100644 --- a/ASTree.cpp +++ b/ASTree.cpp @@ -638,7 +638,10 @@ PycRef BuildFromCode(PycRef code, PycModule* mod) stack.pop(); PycRef left = stack.top(); stack.pop(); - stack.push(new ASTCompare(left, right, operand)); + auto arg = operand; + if (mod->verCompare(3, 12) >= 0) + arg >>= 4; // changed under GH-100923 + stack.push(new ASTCompare(left, right, arg)); } break; case Pyc::CONTAINS_OP_A: diff --git a/bytecode.cpp b/bytecode.cpp index 1dc9dc0..33c1abc 100644 --- a/bytecode.cpp +++ b/bytecode.cpp @@ -489,10 +489,15 @@ void bc_disasm(std::ostream& pyc_output, PycRef code, PycModule* mod, } break; case Pyc::COMPARE_OP_A: - if (static_cast(operand) < cmp_strings_len) - formatted_print(pyc_output, "%d (%s)", operand, cmp_strings[operand]); - else - formatted_print(pyc_output, "%d (UNKNOWN)", operand); + { + auto arg = operand; + if (mod->verCompare(3, 12) >= 0) + arg >>= 4; // changed under GH-100923 + if (static_cast(arg) < cmp_strings_len) + formatted_print(pyc_output, "%d (%s)", operand, cmp_strings[arg]); + else + formatted_print(pyc_output, "%d (UNKNOWN)", operand); + } break; case Pyc::BINARY_OP_A: if (static_cast(operand) < binop_strings_len)