• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.circleci/H25-Sep-2021-6864

.github/H25-Sep-2021-1311

admin-tools/H25-Sep-2021-381282

appveyor/H25-Sep-2021-318277

bin/H25-Sep-2021-64

doc/H25-Sep-2021-180125

maynard-tool/H25-Sep-2021-3,1252,516

pytest/H25-Sep-2021-5,0504,613

test/H03-May-2022-1,046763

test_unit/H25-Sep-2021-1,8681,450

xdis/H25-Sep-2021-10,5827,582

xdis.egg-info/H03-May-2022-163120

.editorconfigH A D10-Sep-2021450 2923

.gitignoreH A D25-Sep-2021733 4948

.pre-commit-config.yamlH A D10-Sep-2021302 1312

.travis.ymlH A D25-Sep-2021364 2319

COPYINGH A D25-Mar-201817.6 KiB340281

ChangeLogH A D25-Sep-2021309.6 KiB8,1046,273

MANIFEST.inH A D19-May-2020293 1312

MakefileH A D25-Sep-20212.9 KiB12362

NEWS.mdH A D25-Sep-202131.3 KiB933650

PKG-INFOH A D25-Sep-20215.4 KiB163120

README.rstH A D25-Sep-20214 KiB12788

__pkginfo__.pyH A D25-Sep-20213.1 KiB9751

appveyor.ymlH A D08-Jun-20182.6 KiB8062

setup-master.shH A D02-Dec-201754 31

setup.cfgH A D25-Sep-2021438 3630

setup.pyH A D10-Sep-2021897 4236

tox.iniH A D10-Sep-2021532 2016

README.rst

1|TravisCI| |CircleCI| |PyPI Installs| |Latest Version| |Supported Python Versions|
2
3|packagestatus|
4
5xdis
6====
7
8A Cross-Python bytecode disassembler, bytecode/wordcode and magic-number manipulation library/package.
9
10
11Introduction
12------------
13
14The Python dis_ module allows you to disassemble bytecode from the same
15version of Python that you are running on. But what about bytecode from
16different versions?
17
18That's what this package is for. It can "marshal load" Python
19bytecodes from different versions of Python. The command-line routine
20*pydisasm* will show disassembly output using Python 3.8 disassembly
21conventions.
22
23Also, if you need to modify and write bytecode, the routines here can
24be of help. There are routines to pack and unpack the read-only tuples
25in Python's Code type. For interoperability between Python 2 and 3 we
26provide our own versions of the Code type, and we provide routines to
27reduce the tedium in writing a bytecode file.
28
29This package also has an extensive knowledge of Python bytecode magic
30numbers, including Pypy and others, and how to translate from
31`sys.sys_info` major, minor, and release numbers to the corresponding
32magic value.
33
34So If you want to write a cross-version assembler, or a
35bytecode-level optimizer this package may also be useful. In addition
36to the kinds of instruction categorization that `dis` offers, we have
37additional categories for things that would be useful in such a
38bytecode optimizer.
39
40The programs here accept bytecodes from Python version 1.0 to 3.8 or
41so. The code requires Python 2.4 or later and has been tested on
42Python running lots of Python versions.
43
44To install versions for Python before 2.6 install via eggs or
45use the python-2.4 branch of git in github.
46
47
48Installation
49------------
50
51The standard Python routine:
52
53::
54
55    $ pip install -e .
56    $ pip install -r requirements-dev.txt
57
58A GNU makefile is also provided so :code:`make install` (possibly as root or
59sudo) will do the steps above.
60
61Testing
62-------
63
64::
65
66   $ make check
67
68A GNU makefile has been added to smooth over setting running the right
69command, and running tests from fastest to slowest.
70
71If you have remake_ installed, you can see the list of all tasks
72including tests via :code:`remake --tasks`.
73
74
75Usage
76-----
77
78Run
79
80::
81
82     $ ./bin/pydisasm -h
83
84for usage help.
85
86
87As a drop-in replacement for dis
88~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
89
90`xdis` also provides some support as a drop in replacement for the
91the Python library `dis <https://docs.python.org/3/library/dis.html>`_
92module. This is may be desirable when you want to use the improved API
93from Python 3.4 or later from an earlier Python version.
94
95For example:
96
97>>> # works in Python 2 and 3
98>>> import xdis.std as dis
99>>> [x.opname for x in dis.Bytecode('a = 10')]
100['LOAD_CONST', 'STORE_NAME', 'LOAD_CONST', 'RETURN_VALUE']
101
102There may some small differences in output produced for formatted
103disassembly or how we show compiler flags. We expect you'll
104find the `xdis` output more informative though.
105
106See Also
107--------
108
109* https://pypi.org/project/uncompyle6/ : Python Bytecode Deparsing
110* https://pypi.org/project/xasm/ : Python Bytecode Assembler
111* https://pypi.org/project/x-python/ : Python Bytecode Interpreter written in Python
112
113.. _trepan: https://pypi.python.org/pypi/trepan
114.. _debuggers: https://pypi.python.org/pypi/trepan3k
115.. _remake: http://bashdb.sf.net/remake
116.. |TravisCI| image:: https://travis-ci.org/rocky/python-xdis.svg?branch=master
117		 :target: https://travis-ci.org/rocky/python-xdis
118.. |CircleCI| image:: https://circleci.com/gh/rocky/python-xdis.svg?style=svg
119    :target: https://circleci.com/gh/rocky/python-xdis
120.. |Supported Python Versions| image:: https://img.shields.io/pypi/pyversions/xdis.svg
121.. |Latest Version| image:: https://badge.fury.io/py/xdis.svg
122		 :target: https://badge.fury.io/py/xdis
123.. |PyPI Installs| image:: https://pepy.tech/badge/xdis/month
124.. |packagestatus| image:: https://repology.org/badge/vertical-allrepos/python:xdis.svg
125		 :target: https://repology.org/project/python:xdis/versions
126.. _dis: https://docs.python.org/3/library/dis.html
127