diff --git a/ASTree.cpp b/ASTree.cpp index 87762654c..840d55799 100644 --- a/ASTree.cpp +++ b/ASTree.cpp @@ -1473,8 +1473,9 @@ PycRef BuildFromCode(PycRef code, PycModule* mod) { PycRef name = stack.top(); if (name.type() != ASTNode::NODE_IMPORT) { + auto arg = (mod->verCompare(3, 12) >= 0) ? operand >> 1 : operand; stack.pop(); - stack.push(new ASTBinary(name, new ASTName(code->getName(operand)), ASTBinary::BIN_ATTR)); + stack.push(new ASTBinary(name, new ASTName(code->getName(arg)), ASTBinary::BIN_ATTR)); } } break; diff --git a/bytecode.cpp b/bytecode.cpp index 33c1abcbf..0d780fb76 100644 --- a/bytecode.cpp +++ b/bytecode.cpp @@ -390,7 +390,10 @@ void bc_disasm(std::ostream& pyc_output, PycRef code, PycModule* mod, case Pyc::LOAD_METHOD_A: case Pyc::LOAD_FROM_DICT_OR_GLOBALS_A: try { - formatted_print(pyc_output, "%d: %s", operand, code->getName(operand)->value()); + auto arg = operand; + if (opcode == Pyc::LOAD_ATTR_A && mod->verCompare(3, 12) >= 0) + arg >>= 1; + formatted_print(pyc_output, "%d: %s", operand, code->getName(arg)->value()); } catch (const std::out_of_range &) { formatted_print(pyc_output, "%d ", operand); }