Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ncaklovic/pycdc
Browse files Browse the repository at this point in the history
  • Loading branch information
zrax committed Feb 28, 2024
2 parents 8e48bf2 + 32c1ca1 commit 1f30136
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 1 addition & 2 deletions ASTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion bytecode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 1f30136

Please sign in to comment.