opcode_15.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # (C) Copyright 2017, 2019-2021, 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 1.5 bytecode opcodes
  18. This is a like Python 1.5's opcode.py with some classification
  19. of stack usage and information for formatting instructions.
  20. of stack usage.
  21. """
  22. import xdis.opcodes.opcode_1x as opcode_1x
  23. from xdis.opcodes.base import ( # Although these aren't used here, they are exported
  24. finalize_opcodes,
  25. init_opdata,
  26. update_pj2,
  27. )
  28. from xdis.opcodes.opcode_1x import opcode_extended_fmt_base1x, update_arg_fmt_base1x
  29. version_tuple = (1, 5)
  30. python_implementation = "CPython"
  31. loc = locals()
  32. init_opdata(loc, opcode_1x, version_tuple)
  33. # opcode_1x is based on 1.5 so there are no opcodes to add or change.
  34. # If there were, they'd be listed below.
  35. opcode_arg_fmt = update_arg_fmt_base1x.copy()
  36. opcode_extended_fmt = opcode_extended_fmt_base1x.copy()
  37. update_pj2(globals(), loc)
  38. finalize_opcodes(loc)