Skip to content
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
Prev Previous commit
Next Next commit
Move comment
  • Loading branch information
vstinner committed Dec 7, 2018
commit 0133edbc752ae48ac9f46f97c9169b9a29cdc4e3
9 changes: 4 additions & 5 deletions Python/peephole.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,15 +365,14 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names,
stack effect */
h = set_arg(codestr, i, get_arg(codestr, tgt));
} else {
Py_ssize_t arg = (tgt + 1);
/* cannot overflow: codelen <= INT_MAX */
assert((size_t)arg <= UINT_MAX / sizeof(_Py_CODEUNIT));
arg *= sizeof(_Py_CODEUNIT);

/* The second jump is not taken if the first is (so

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would keep the comment at the beginning of the block.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done

jump past it), and all conditional jumps pop their
argument when they're not taken (so change the
first jump to pop its argument when it's taken). */
Py_ssize_t arg = (tgt + 1);
/* cannot overflow: codelen <= INT_MAX */
assert((size_t)arg <= UINT_MAX / sizeof(_Py_CODEUNIT));
arg *= sizeof(_Py_CODEUNIT);
h = set_arg(codestr, i, (unsigned int)arg);
j = opcode == JUMP_IF_TRUE_OR_POP ?
POP_JUMP_IF_TRUE : POP_JUMP_IF_FALSE;
Expand Down