Merge branch 'master' of github.com:ncaklovic/pycdc

This commit is contained in:
Michael Hansen
2024-02-28 15:43:00 -08:00
2 changed files with 5 additions and 3 deletions

View File

@@ -1481,8 +1481,7 @@ PycRef<ASTNode> BuildFromCode(PycRef<PycCode> code, PycModule* mod)
if (name.type() != ASTNode::NODE_IMPORT) {
stack.pop();
if (mod->verCompare(3, 12) >= 0)
{
if (mod->verCompare(3, 12) >= 0) {
if (operand & 1) {
/* Changed in version 3.12:
If the low bit of namei is set, then a NULL or self is pushed to the stack

View File

@@ -390,7 +390,10 @@ void bc_disasm(std::ostream& pyc_output, PycRef<PycCode> 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 <INVALID>", operand);
}