opcode_21.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # (C) Copyright 2017, 2019, 2023 by Rocky Bernstein
  2. #
  3. # This program is free software; you can redistribute it and/or
  4. # modify it under the terms of the GNU General Public License
  5. # as published by the Free Software Foundation; either version 2
  6. # of the License, or (at your option) any later version.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program; if not, write to the Free Software
  15. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  16. """
  17. CPython 2.1 bytecode opcodes
  18. This is similar to the opcode portion in Python 2.1's dis.py library.
  19. """
  20. import xdis.opcodes.opcode_22 as opcode_22
  21. from xdis.opcodes.base import (
  22. finalize_opcodes,
  23. init_opdata,
  24. rm_op,
  25. update_pj2,
  26. )
  27. from xdis.opcodes.opcode_2x import update_arg_fmt_base2x, opcode_extended_fmt_base2x
  28. version_tuple = (2, 1)
  29. python_implementation = "CPython"
  30. loc = locals()
  31. init_opdata(loc, opcode_22, version_tuple)
  32. # 2.1 bytecodes changes from 2.2
  33. rm_op(loc, "BINARY_FLOOR_DIVIDE", 26)
  34. rm_op(loc, "BINARY_TRUE_DIVIDE", 27)
  35. rm_op(loc, "INPLACE_FLOOR_DIVIDE", 28)
  36. rm_op(loc, "INPLACE_TRUE_DIVIDE", 29)
  37. rm_op(loc, "GET_ITER", 68)
  38. rm_op(loc, "YIELD_VALUE", 86)
  39. rm_op(loc, "FOR_ITER", 93)
  40. opcode_arg_fmt = update_arg_fmt_base2x.copy()
  41. opcode_extended_fmt = opcode_extended_fmt12 = opcode_extended_fmt_base2x.copy()
  42. update_pj2(globals(), loc)
  43. finalize_opcodes(loc)