Skip to main content

Python cross-version byte-code disassembler and marshal routines

Project description

TravisCI CircleCI PyPI Installs Latest Version Supported Python Versions

packagestatus

xdis

A Cross-Python bytecode disassembler, bytecode/wordcode and magic-number manipulation library/package.

Introduction

The Python dis module allows you to disassemble bytecode from the same version of Python that you are running on. But what about bytecode from different versions?

That’s what this package is for. It can “marshal load” Python bytecodes from different versions of Python. The command-line routine pydisasm will show disassembly output using Python 3.8 disassembly conventions.

Also, if you need to modify and write bytecode, the routines here can be of help. There are routines to pack and unpack the read-only tuples in Python’s Code type. For interoperability between Python 2 and 3 we provide our own versions of the Code type, and we provide routines to reduce the tedium in writing a bytecode file.

This package also has an extensive knowledge of Python bytecode magic numbers, including Pypy and others, and how to translate from sys.sys_info major, minor, and release numbers to the corresponding magic value.

So If you want to write a cross-version assembler, or a bytecode-level optimizer this package may also be useful. In addition to the kinds of instruction categorization that dis offers, we have additional categories for things that would be useful in such a bytecode optimizer.

The programs here accept bytecodes from Python version 1.0 to 3.8 or so. The code requires Python 2.4 or later and has been tested on Python running lots of Python versions.

To install versions for Python before 2.6 install via eggs or use the python-2.4 branch of git in github.

Installation

The standard Python routine:

$ pip install -e .
$ pip install -r requirements-dev.txt

A GNU makefile is also provided so make install (possibly as root or sudo) will do the steps above.

Testing

$ make check

A GNU makefile has been added to smooth over setting running the right command, and running tests from fastest to slowest.

If you have remake installed, you can see the list of all tasks including tests via remake --tasks.

Usage

Run

$ ./bin/pydisasm -h

for usage help.

As a drop-in replacement for dis

xdis also provides some support as a drop in replacement for the the Python library dis module. This is may be desirable when you want to use the improved API from Python 3.4 or later from an earlier Python version.

For example:

>>> # works in Python 2 and 3
>>> import xdis.std as dis
>>> [x.opname for x in dis.Bytecode('a = 10')]
['LOAD_CONST', 'STORE_NAME', 'LOAD_CONST', 'RETURN_VALUE']

There may some small differences in output produced for formatted disassembly or how we show compiler flags. We expect you’ll find the xdis output more informative though.

See Also

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xdis-5.0.3.tar.gz (232.7 kB view details)

Uploaded Source

Built Distributions

xdis-5.0.3-py37-none-any.whl (125.8 kB view details)

Uploaded Python 3.7

xdis-5.0.3-py36-none-any.whl (125.8 kB view details)

Uploaded Python 3.6

xdis-5.0.3-py35-none-any.whl (125.8 kB view details)

Uploaded Python 3.5

xdis-5.0.3-py34-none-any.whl (125.8 kB view details)

Uploaded Python 3.4

xdis-5.0.3-py33-none-any.whl (121.6 kB view details)

Uploaded Python 3.3

xdis-5.0.3-py32-none-any.whl (121.6 kB view details)

Uploaded Python 3.2

xdis-5.0.3-py27-none-any.whl (125.8 kB view details)

Uploaded Python 2.7

xdis-5.0.3-py26-none-any.whl (121.6 kB view details)

Uploaded Python 2.6

xdis-5.0.3-py3.8.egg (238.7 kB view details)

Uploaded Source

xdis-5.0.3-py3.7.egg (238.0 kB view details)

Uploaded Source

xdis-5.0.3-py3.6.egg (238.2 kB view details)

Uploaded Source

xdis-5.0.3-py3.5.egg (242.4 kB view details)

Uploaded Source

xdis-5.0.3-py3.4.egg (243.2 kB view details)

Uploaded Source

xdis-5.0.3-py3.3.egg (244.5 kB view details)

Uploaded Source

xdis-5.0.3-py3.2.egg (241.6 kB view details)

Uploaded Source

xdis-5.0.3-py2.7.egg (239.1 kB view details)

Uploaded Source

xdis-5.0.3-py2.6.egg (239.5 kB view details)

Uploaded Source

xdis-5.0.3-py2.5.egg (247.8 kB view details)

Uploaded Source

xdis-5.0.3-py2.4.egg (252.5 kB view details)

Uploaded Source

File details

Details for the file xdis-5.0.3.tar.gz.

File metadata

  • Download URL: xdis-5.0.3.tar.gz
  • Upload date:
  • Size: 232.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for xdis-5.0.3.tar.gz
Algorithm Hash digest
SHA256 69653ec580651cbba8ae1a36b880c10f2bf4ba76b3fc039960ffa45a64af5f21
MD5 7ce6a55c0d290061fe92293b6347ec29
BLAKE2b-256 6b8b5a0d52a50e302f200d2ff75bae6a5228b1bfff6118eefafca040c14c608e

See more details on using hashes here.

Provenance

File details

Details for the file xdis-5.0.3-py37-none-any.whl.

File metadata

  • Download URL: xdis-5.0.3-py37-none-any.whl
  • Upload date:
  • Size: 125.8 kB
  • Tags: Python 3.7
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for xdis-5.0.3-py37-none-any.whl
Algorithm Hash digest
SHA256 629bdb1fe3991f0e992dd2ee9bf31aa818e1a95375b42f4b536a02f418a2aee6
MD5 34cb81ad105d0d0be71ad501904cbd62
BLAKE2b-256 3d1c383713e9c962b98a25a8583fb58540cee7eb433a41048b6ce14dfb111e2b

See more details on using hashes here.

Provenance

File details

Details for the file xdis-5.0.3-py36-none-any.whl.

File metadata

  • Download URL: xdis-5.0.3-py36-none-any.whl
  • Upload date:
  • Size: 125.8 kB
  • Tags: Python 3.6
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for xdis-5.0.3-py36-none-any.whl
Algorithm Hash digest
SHA256 72aa95a58f88625ec6a6926f1a0fd9a27aec0494c3867692e7ba83872608cc4f
MD5 c32b95ef878646c6267c9e68c776b073
BLAKE2b-256 7788f74703ed93ec35f5d08220ed75d85701239ffc3d1496f871e3843e1e2faa

See more details on using hashes here.

Provenance

File details

Details for the file xdis-5.0.3-py35-none-any.whl.

File metadata

  • Download URL: xdis-5.0.3-py35-none-any.whl
  • Upload date:
  • Size: 125.8 kB
  • Tags: Python 3.5
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for xdis-5.0.3-py35-none-any.whl
Algorithm Hash digest
SHA256 c323cbfce4de48e8e14b01e0aaf891bd2554c0ce5a4d088968961c59a7af5e8c
MD5 4e567602e1c437c3a2d2b0510c41568a
BLAKE2b-256 b947fb23eab6ab956118233fb2cafdb84fdac2abd37940a9111f9629b776d02b

See more details on using hashes here.

Provenance

File details

Details for the file xdis-5.0.3-py34-none-any.whl.

File metadata

  • Download URL: xdis-5.0.3-py34-none-any.whl
  • Upload date:
  • Size: 125.8 kB
  • Tags: Python 3.4
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for xdis-5.0.3-py34-none-any.whl
Algorithm Hash digest
SHA256 869c45f25f716ba2dcc3f5902f37b31d7454204495e2f60ca435e62349f79c82
MD5 303ba4503e5b8b3074db6d50f4a1afc0
BLAKE2b-256 52bee2e7970125011a67c9a6878f17d285f61933565ab96351e661a3a3db672e

See more details on using hashes here.

Provenance

File details

Details for the file xdis-5.0.3-py33-none-any.whl.

File metadata

  • Download URL: xdis-5.0.3-py33-none-any.whl
  • Upload date:
  • Size: 121.6 kB
  • Tags: Python 3.3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for xdis-5.0.3-py33-none-any.whl
Algorithm Hash digest
SHA256 d832cd41c01485d3644b69ca58b2d2ac51b4f1f5354514960dc41de82663b884
MD5 2fe2dae8eef58238e425fda7c159803d
BLAKE2b-256 8aef58d73d7eae5e840c503fb7e213708b5f067a634635ee4f03695ad6d6ae3f

See more details on using hashes here.

Provenance

File details

Details for the file xdis-5.0.3-py32-none-any.whl.

File metadata

  • Download URL: xdis-5.0.3-py32-none-any.whl
  • Upload date:
  • Size: 121.6 kB
  • Tags: Python 3.2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for xdis-5.0.3-py32-none-any.whl
Algorithm Hash digest
SHA256 8cde6cf9147542f106657c309fd09f92b7f5cfd0df8d729b0fb508e3aeb97787
MD5 8c709fedeedafb8ddf9df989c6a4ed88
BLAKE2b-256 4e3d6112c197ebf01752753116c6507356809bb71b3ff4e42778d8664a913532

See more details on using hashes here.

Provenance

File details

Details for the file xdis-5.0.3-py27-none-any.whl.

File metadata

  • Download URL: xdis-5.0.3-py27-none-any.whl
  • Upload date:
  • Size: 125.8 kB
  • Tags: Python 2.7
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for xdis-5.0.3-py27-none-any.whl
Algorithm Hash digest
SHA256 d4bcebc31da6fa4d6500cfa3f142cf8d4d8f384e6d7daaabc3159a6046b22881
MD5 e3f899eb1e92bec7915264966d8ed5cb
BLAKE2b-256 393e7ae396afd78f55346c5c89279c4adb49ff96e78ddcdc71b21e42e056ffe3

See more details on using hashes here.

Provenance

File details

Details for the file xdis-5.0.3-py26-none-any.whl.

File metadata

  • Download URL: xdis-5.0.3-py26-none-any.whl
  • Upload date:
  • Size: 121.6 kB
  • Tags: Python 2.6
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for xdis-5.0.3-py26-none-any.whl
Algorithm Hash digest
SHA256 c522e9185db19c454f9938bb351c7d279244818500b268c5b91336cc20f85de8
MD5 199c489de003ad9d1ce3c050ee597b96
BLAKE2b-256 0e7ca14ff18e085ec49f51c02802f12720181e8ba020a67e8354578a2f8b09ae

See more details on using hashes here.

Provenance

File details

Details for the file xdis-5.0.3-py3.8.egg.

File metadata

  • Download URL: xdis-5.0.3-py3.8.egg
  • Upload date:
  • Size: 238.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for xdis-5.0.3-py3.8.egg
Algorithm Hash digest
SHA256 466af3e5a6f5816f451a1719e22c6c58945bb431192b00902ae9aeab93acd011
MD5 48f19af42b4a6a34c5dff9adaa6e17a0
BLAKE2b-256 58f4865a9962c0c5a5e5beb7e7d14fddb5a471e1ab4364639326f2bd11cb807a

See more details on using hashes here.

Provenance

File details

Details for the file xdis-5.0.3-py3.7.egg.

File metadata

  • Download URL: xdis-5.0.3-py3.7.egg
  • Upload date:
  • Size: 238.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for xdis-5.0.3-py3.7.egg
Algorithm Hash digest
SHA256 970ae615186bef1e1e3ee2cb5e19356a6e9d8272b2065e1e3e52f55deaa0065a
MD5 2d1f08032c2d05383c469e8465d490b8
BLAKE2b-256 f598330c6536533abb438cd3fb4842536b54267f975497a3e75898ad8a473ba4

See more details on using hashes here.

Provenance

File details

Details for the file xdis-5.0.3-py3.6.egg.

File metadata

  • Download URL: xdis-5.0.3-py3.6.egg
  • Upload date:
  • Size: 238.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for xdis-5.0.3-py3.6.egg
Algorithm Hash digest
SHA256 7de11809516b3687b4fcf190034bddb7d2e398db0f965d291564a1448f5683e9
MD5 cf882f6daf36399f5b29bd288dd5152d
BLAKE2b-256 55d37498ff59cc3ce1c465ff3f96d0cc6382e53bb816eeb90f63ab18af3d562a

See more details on using hashes here.

Provenance

File details

Details for the file xdis-5.0.3-py3.5.egg.

File metadata

  • Download URL: xdis-5.0.3-py3.5.egg
  • Upload date:
  • Size: 242.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for xdis-5.0.3-py3.5.egg
Algorithm Hash digest
SHA256 d03f9984bf32c27cd8ccc18836019414a9086acbc601ba1562203c496b72ba50
MD5 762fc039a04e612a5092ee530f9741ca
BLAKE2b-256 99a2f65d5408de9a89fce74f62f6a60e49779ef00523d0e9607f4b84dbe9e1a2

See more details on using hashes here.

Provenance

File details

Details for the file xdis-5.0.3-py3.4.egg.

File metadata

  • Download URL: xdis-5.0.3-py3.4.egg
  • Upload date:
  • Size: 243.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for xdis-5.0.3-py3.4.egg
Algorithm Hash digest
SHA256 d841be6410e1a6bb8975af17cb8519652665ea28be4b8842cb15aadcd5f330c1
MD5 2563043e5457c86515ddae32d72d52f5
BLAKE2b-256 0f0bc3e7f3be8afd0e907743b6652c32f7c27d2fcae04c6688e2bd42045f5a33

See more details on using hashes here.

Provenance

File details

Details for the file xdis-5.0.3-py3.3.egg.

File metadata

  • Download URL: xdis-5.0.3-py3.3.egg
  • Upload date:
  • Size: 244.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for xdis-5.0.3-py3.3.egg
Algorithm Hash digest
SHA256 699447094a21472f4117dee0740093d2a652e02d6ffbdbf59699c3f3bab0dd6a
MD5 cbfcb12c8dc75b16d9950199468a2136
BLAKE2b-256 31c15bf5dd572035b2978df328440c018c068a234f48e209a9ccef0e1748a133

See more details on using hashes here.

Provenance

File details

Details for the file xdis-5.0.3-py3.2.egg.

File metadata

  • Download URL: xdis-5.0.3-py3.2.egg
  • Upload date:
  • Size: 241.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for xdis-5.0.3-py3.2.egg
Algorithm Hash digest
SHA256 be0d905f2ce233a8a2fc4a29005495844c3135c8a32b2356f8dc5e5c70f7d863
MD5 7f83ffa104e07cdd199155a48c4ae532
BLAKE2b-256 6b1dc7fbbe847f4116773e97fa5798c7900fc05ba2e6a0324e5781e177c48ffa

See more details on using hashes here.

Provenance

File details

Details for the file xdis-5.0.3-py2.7.egg.

File metadata

  • Download URL: xdis-5.0.3-py2.7.egg
  • Upload date:
  • Size: 239.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for xdis-5.0.3-py2.7.egg
Algorithm Hash digest
SHA256 d98fa240c695dec53266a4c92ff48da4e48e7850b5f720345e9f7863d1bec217
MD5 cc312eabda80d4affa9795d88be22f83
BLAKE2b-256 b6dcc837ace975ef9d5cb74fb675c6fb5445b55b218ddcc4ce6afd66a43f2054

See more details on using hashes here.

Provenance

File details

Details for the file xdis-5.0.3-py2.6.egg.

File metadata

  • Download URL: xdis-5.0.3-py2.6.egg
  • Upload date:
  • Size: 239.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for xdis-5.0.3-py2.6.egg
Algorithm Hash digest
SHA256 67f7ecae30e38811c258acba8959c5751cf57a5e5aa895185fa277eae9205cd9
MD5 567fe957d8caea695092cf1468265a31
BLAKE2b-256 7d5b3a7c2192729432e962421d6772cbe32e062305d7f9ab4fca304ad66af193

See more details on using hashes here.

Provenance

File details

Details for the file xdis-5.0.3-py2.5.egg.

File metadata

  • Download URL: xdis-5.0.3-py2.5.egg
  • Upload date:
  • Size: 247.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for xdis-5.0.3-py2.5.egg
Algorithm Hash digest
SHA256 ae8a30c93b089f21a5f33204e5a677e6d24fdd3f7a8148490b0fbdf80028c398
MD5 53726e25c88ea616f05b84f60b0d35ec
BLAKE2b-256 f5347e2399610eb7a98fa2bbdb3cf2ef9175ce7474387a5ad88023179dacebb0

See more details on using hashes here.

Provenance

File details

Details for the file xdis-5.0.3-py2.4.egg.

File metadata

  • Download URL: xdis-5.0.3-py2.4.egg
  • Upload date:
  • Size: 252.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for xdis-5.0.3-py2.4.egg
Algorithm Hash digest
SHA256 a08925a316d5760a0faa10437388a9e8372945eb7b662e0e4bb9ac0bd872f884
MD5 21183530979611c297bf7e78c38eeb21
BLAKE2b-256 f676973f7ba6e6d895c9c8cec363127f2449e4fbb9ffd7644e27182c99c2470e

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page