Skip to content

Commit

Permalink
Reduce number of compiler warnings in generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
markshannon committed Oct 18, 2024
1 parent 760872e commit 5f7ee19
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Include/internal/pycore_opcode_metadata.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,9 @@ dummy_func(
tstate->current_frame = frame->previous;
assert(!_PyErr_Occurred(tstate));
tstate->c_recursion_remaining += PY_EVAL_C_STACK_UNITS;
return PyStackRef_AsPyObjectSteal(retval);
PyObject *result = PyStackRef_AsPyObjectSteal(retval);
SYNC_SP(); /* Not strictly necessary, but prevents warnings */
return result;
}

// The stack effect here is ambiguous.
Expand Down Expand Up @@ -1874,7 +1876,7 @@ dummy_func(
ERROR_IF(err != 0, error);
}

inst(INSTRUMENTED_LOAD_SUPER_ATTR, (unused/1, unused, unused, unused -- unused, unused if (oparg & 1))) {
inst(INSTRUMENTED_LOAD_SUPER_ATTR, (unused/1 -- )) {
// cancel out the decrement that will happen in LOAD_SUPER_ATTR; we
// don't want to specialize instrumented instructions
PAUSE_ADAPTIVE_COUNTER(this_instr[1].counter);
Expand Down
6 changes: 3 additions & 3 deletions Python/generated_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Tools/cases_generator/tier2_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def declare_variables(uop: Uop, out: CWriter) -> None:


class Tier2Emitter(Emitter):

def __init__(self, out: CWriter):
super().__init__(out)
self._replacers["oparg"] = self.oparg
Expand Down

0 comments on commit 5f7ee19

Please sign in to comment.