10000 GH-98686: Fix compiler warning for `HAS_ARG` by brandtbucher · Pull Request #99106 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-98686: Fix compiler warning for HAS_ARG #99106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 4, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ lltrace_instruction(_PyInterpreterFrame *frame,
const char *opname = _PyOpcode_OpName[opcode];
assert(opname != NULL);
int offset = (int)(next_instr - _PyCode_CODE(frame->f_code));
if (HAS_ARG(_PyOpcode_Deopt[opcode])) {
if (HAVE_ARGUMENT <= _PyOpcode_Deopt[opcode]) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HAVE_ARGUMENT isn't used directly anywhere else. I think casting and using HAS_ARG might be better.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we don't have to worry about things like pseudo-opcodes, right? This seems like exactly the sort of thing HAVE_ARGUMENT is meant for...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kind of. HAVE_ARGUMENT was there before we had pseudo-opcodes, and HAS_ARG just compared with it. Now we have pseudo-opcodes, and if I saw HAVE_ARGUMENT in the code now my first thought would be that this is a bug (a place where we didn't update for pseudo-opcodes). So the trick is to make this not look like a bug.

printf("%d: %s %d\n", offset * 2, opname, oparg);
}
else {
Expand Down
0