Skip to content

Commit 4fb7e84

Browse files
committed
fix: incorrect error message in ASTree::BuildFromCode(...)
* `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.
1 parent dc6ca4a commit 4fb7e84

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ASTree.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2474,7 +2474,8 @@ PycRef<ASTNode> BuildFromCode(PycRef<PycCode> code, PycModule* mod)
24742474
}
24752475
break;
24762476
default:
2477-
fprintf(stderr, "Unsupported opcode: %s\n", Pyc::OpcodeName(opcode & 0xFF));
2477+
int bytecode = code->code()->value()[curpos] & 0xFF;
2478+
fprintf(stderr, "Unsupported opcode: %s (bytecode 0x%02x (%d) at position %d)\n", Pyc::OpcodeName(opcode), bytecode, bytecode, curpos);
24782479
cleanBuild = false;
24792480
return new ASTNodeList(defblock->nodes());
24802481
}

0 commit comments

Comments
 (0)