opcode_24.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # (C) Copyright 2017, 2020-2021, 2023 by Rocky Bernstein
  2. """
  3. CPython 2.4 bytecode opcodes
  4. This is a like Python 2.3's opcode.py with some additional classification
  5. of stack usage, and opererand formatting functions.
  6. """
  7. import xdis.opcodes.opcode_2x as opcode_2x
  8. from xdis.opcodes.base import (
  9. def_op,
  10. finalize_opcodes,
  11. init_opdata,
  12. update_pj2,
  13. )
  14. from xdis.opcodes.opcode_2x import update_arg_fmt_base2x, opcode_extended_fmt_base2x
  15. version_tuple = (2, 4)
  16. python_implementation = "CPython"
  17. loc = locals()
  18. init_opdata(loc, opcode_2x, version_tuple)
  19. # fmt: off
  20. # Bytecodes added since 2.3
  21. # OP NAME OPCODE POP PUSH
  22. # Used to implement list comprehensions.
  23. def_op(loc, 'YIELD_VALUE', 86, 1, 1)
  24. # --------------------------------------------
  25. def_op(loc, "NOP", 9, 0, 0)
  26. def_op(loc, "LIST_APPEND", 18, 2, 0) # Calls list.append(TOS[-i], TOS).
  27. # Used to implement list comprehensions.
  28. def_op(loc, "YIELD_VALUE", 86, 1, 1)
  29. opcode_arg_fmt = update_arg_fmt_base2x.copy()
  30. opcode_extended_fmt = opcode_extended_fmt12 = opcode_extended_fmt_base2x.copy()
  31. # FIXME remove (fix uncompyle6)
  32. update_pj2(globals(), loc)
  33. finalize_opcodes(loc)
  34. # fmt: on