Kirill Balunov <[email protected]> added the comment:
Sorry if this doesn't fit this issue and needs a separate one.
Since Python switched to 2 byte wordcode, all opcodes which do not imply an
argument, technically have it - augmented with 0. So it is convenient to
iterate over bytecode like:
op, arg = instruction.
But there is a check in stack_effect that the second argument for this opcodes
must be None.
file::_opcode.c
else if (oparg != Py_None) {
PyErr_SetString(PyExc_ValueError,
"stack_effect: opcode does not permit oparg but oparg was
specified");
return -1;
}
So you need to perform a somewhat _redundant_ check before calling:
arg = arg if op >= opcode.HAVE_ARGUMENT else None.
st = stack_effect(op, arg)
Maybe it's normal to relax this condition - be None or 0 for opcode <
opcode.HAVE_ARGUMENT?
----------
nosy: +godaygo
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue32455>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com