Document BINARY_OP_ opcodes?

Where did you search? In the 3.11 sources, BINARY_OP_ADAPTIVE (and many other _ADAPTIVE) opcodes exist; in main (to become 3.12) they no longer exist.

All the opcodes you mention are “specialized” opcodes, and will never be seen in the co_code attribute of code objects when requested from Python code. They are inserted dynamically in Python/specialize.c. The numeric values of these are dynamically calculated in code that is intentionally hard to find (but the values are revealed in Include/opcode.h). You might find a little more background information about this topic in PEP 659 (Specializing Adaptive Interpreter).

Basically, adaptive opcodes are a stepping stone towards specialization. LOAD_CONST__LOAD_FAST and friends are “super-instructions” that replace a pair (here, LOAD_CONST + LOAD_FAST) but save a little of the dispatch effort.

I’d be reluctant to document any of these, since there’s such a small audience for the documentation, and things are changing quickly in 3.12. I’m curious what led you to find these in the first place?

4 Likes