Skip to content
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

GH-98686: Fix compiler warning for HAS_ARG #99106

Merged
merged 2 commits into from
Nov 4, 2022

Conversation

brandtbucher
Copy link
Member

@brandtbucher brandtbucher commented Nov 4, 2022

@brandtbucher brandtbucher added skip news interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Nov 4, 2022
@brandtbucher brandtbucher self-assigned this Nov 4, 2022
Python/ceval.c Outdated
@@ -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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants