[Python-Dev] Unexpected bytecode difference

Alexander Belopolsky alexander.belopolsky at gmail.com
Mon Jan 22 13:09:36 EST 2018


On Fri, Jan 19, 2018 at 7:18 PM, Victor Stinner
<victor.stinner at gmail.com> wrote:
> It seems like the EXTENDED_ARG doc wasn't updated.

I've opened <https://bugs.python.org/issue32625> to update the dis
module documentation.

I have also found a patch (mkfu4.patch) attached to issue 27095 where
EXTENDED_ARG is described as

 .. opcode:: EXTENDED_ARG (ext)

   EXTENDED_ARG adds ``*ext* * 256`` to the next instruction's argument.
   This is used for arguments exceeding a byte in size, and can be chained
   to create 4-byte arguments.

I am not sure this is correct.  First, multiple EXTENDED_ARG codes
seem to add ext * 256 ** i or bit-append ext to arg. Second, it looks
like this mechanism allows forming arguments of arbitrary bit length,
not just 4-byte arguments.


More information about the Python-Dev mailing list