opcode_11.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # (C) Copyright 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 1.1 bytecode opcodes
  18. This is used in bytecode disassembly. This is similar to the
  19. opcodes in Python's dis.py library.
  20. """
  21. import xdis.opcodes.opcode_12 as opcode_12
  22. # This is used from outside this module
  23. from xdis.cross_dis import findlabels
  24. from xdis.opcodes.base import ( # Although these aren't used here, they are exported
  25. finalize_opcodes,
  26. init_opdata,
  27. update_pj2,
  28. )
  29. from xdis.opcodes.opcode_12 import opcode_arg_fmt12, opcode_extended_fmt12
  30. version_tuple = (1, 1) # 1.2 is the same
  31. python_implementation = "CPython"
  32. loc = locals()
  33. init_opdata(loc, opcode_12, version_tuple)
  34. # These are used outside of this module
  35. findlinestarts = opcode_12.findlinestarts
  36. opcode_arg_fmt = opcode_arg_fmt11 = opcode_arg_fmt12.copy()
  37. opcode_extended_fmt = opcode_extended_fmt11 = opcode_extended_fmt12.copy()
  38. update_pj2(globals(), loc)
  39. finalize_opcodes(loc)