You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 17, 2024. It is now read-only.
* Python 3.12 changed the meaning of the arg for both COMPARE_OP
and JUMP instructions:
* For COMPARE_OP, the index now starts at the fifth-lowest bit.
* For JUMP instructions,
"The argument of a jump is the offset of the target instruction relative to the instruction that appears immediately after the jump instruction’s CACHE entries.
As a consequence, the presence of the CACHE instructions is transparent for forward jumps but needs to be taken into account when reasoning about backward jumps."
For both of these, we parse the argrepr. In particular:
* For COMPARE_OP, it be "<", ">", "==", "!=", ">=" or "<=".
* For JUMP instructions, it be "to BYTECODE_OFFSET", which is exactly
twice the instruction index.
* Python 3.12 changed the meaning of FOR_ITER to leave the iterator on
the stack (and push an undocumented object) when exhausted,
and added the instruction END_FOR to pop them both off. However, since
the target for FOR_ITER is always END_FOR (see https://github.com/python/cpython/blob/17a82a1d16a46b6c008240bcc698619419ce5554/Python/bytecodes.c#L2289-L2293),
we can "optimize" it by using the old implementation and making END_FOR a no-op.
* Python 3.12 merged LOAD_ATTR and LOAD_METHOD into one opcode.
* Python 3.12 added BINARY_SLICE and STORE_SLICE opcodes to implement
`a[start:end]` and `a[start:end] = iterable` (previously,
BUILD_SLICE was used followed by `GET_ITEM` or `SET_ITEM`).
* Python 3.12 added END_SEND for generator cleanup, which we
implement as a NOOP.
* Python 3.12 added CLEANUP_THROW and INTRINSIC_STOPITERATION_ERROR,
which replace TOS with its value if TOS a StopIteration,
else reraise the error on TOS. CLEANUP_THROW additionally pops
two additional values off the stack.
* Python 3.12 added LOAD_FAST_CHECK and LOAD_FAST_AND_CLEAR.
LOAD_FAST now will never raise unbound local error,
LOAD_FAST_CHECK might raise an unbound local error,
and LOAD_FAST_AND_CLEAR will load NONE when the local is unbound
(and additionally sets the local to null).
Since Java rightfully says "???" when it sees code that can access
an unbound local, we need to set locals used by
LOAD_FAST_AND_CLEAR to null before generating code
for opcodes.
* Python 3.12 added RETURN_CONST to return a constant.
* Python 3.12 changed UNARY_POS from a "fast" opcode to a
slow "intrinsic" opcode since "+a" is rarely used. This
does not affect us (other than having a new alternative
way of writing "UNARY_POS" as
"INTRINSIC_1_INTRINSIC_UNARY_POSITIVE".
* Simplified and fix some bugs in PythonSlice code
* Add a workaround for jpype-project/jpype#1178
0 commit comments