Skip to content

Commit

Permalink
fix: incorrect error message in ASTree::BuildFromCode(...)
Browse files Browse the repository at this point in the history
* `opcode` was incorrectly clamped causing misleading output.

* modified output with additional info about offending bytecode and position so end-user submissions can become more informative.
  • Loading branch information
wilson0x4d committed Aug 13, 2024
1 parent dc6ca4a commit 4fb7e84
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ASTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2474,7 +2474,8 @@ PycRef<ASTNode> BuildFromCode(PycRef<PycCode> code, PycModule* mod)
}
break;
default:
fprintf(stderr, "Unsupported opcode: %s\n", Pyc::OpcodeName(opcode & 0xFF));
int bytecode = code->code()->value()[curpos] & 0xFF;
fprintf(stderr, "Unsupported opcode: %s (bytecode 0x%02x (%d) at position %d)\n", Pyc::OpcodeName(opcode), bytecode, bytecode, curpos);
cleanBuild = false;
return new ASTNodeList(defblock->nodes());
}
Expand Down

0 comments on commit 4fb7e84

Please sign in to comment.