Skip to main content

Python cross-version byte-code disassembler and marshal routines

Project description

buildstatus Pypi Installs Latest Version Supported Python Versions

packagestatus

xdis

Cross-Python bytecode Disassembler, Bytecode, and Magic Number Manipulation 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.3 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

Release history Release notifications | RSS feed

This version

4.0.4

Download files

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

Source Distribution

xdis-4.0.4.tar.gz (191.1 kB view details)

Uploaded Source

Built Distributions

xdis-4.0.4-py37-none-any.whl (94.9 kB view details)

Uploaded Python 3.7

xdis-4.0.4-py36-none-any.whl (94.9 kB view details)

Uploaded Python 3.6

xdis-4.0.4-py35-none-any.whl (94.9 kB view details)

Uploaded Python 3.5

xdis-4.0.4-py34-none-any.whl (94.9 kB view details)

Uploaded Python 3.4

xdis-4.0.4-py33-none-any.whl (90.7 kB view details)

Uploaded Python 3.3

xdis-4.0.4-py32-none-any.whl (90.7 kB view details)

Uploaded Python 3.2

xdis-4.0.4-py27-none-any.whl (94.9 kB view details)

Uploaded Python 2.7

xdis-4.0.4-py26-none-any.whl (90.7 kB view details)

Uploaded Python 2.6

xdis-4.0.4-py3.7.egg (175.6 kB view details)

Uploaded Source

xdis-4.0.4-py3.6.egg (175.6 kB view details)

Uploaded Source

xdis-4.0.4-py3.5.egg (178.6 kB view details)

Uploaded Source

xdis-4.0.4-py3.4.egg (179.0 kB view details)

Uploaded Source

xdis-4.0.4-py3.3.egg (179.8 kB view details)

Uploaded Source

xdis-4.0.4-py3.2.egg (177.5 kB view details)

Uploaded Source

xdis-4.0.4-py2.7.egg (175.5 kB view details)

Uploaded Source

xdis-4.0.4-py2.6.egg (175.8 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: xdis-4.0.4.tar.gz
  • Upload date:
  • Size: 191.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.7

File hashes

Hashes for xdis-4.0.4.tar.gz
Algorithm Hash digest
SHA256 eb520b91615c9c779b2411817464536dd0af02ec8398455e088d4ee840a61599
MD5 073f26f6107b5daf0f6b78499a00f7cc
BLAKE2b-256 53df3c9ed64d50b8a17016a65efad7be1d11724ed597e06a0737d7b5264b3ee0

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.0.4-py37-none-any.whl
  • Upload date:
  • Size: 94.9 kB
  • Tags: Python 3.7
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.7

File hashes

Hashes for xdis-4.0.4-py37-none-any.whl
Algorithm Hash digest
SHA256 ae0bb0f5f3b6596bc51946dc4e2321b8e5bcf68e6f99db9abf082571299af62d
MD5 5e30c28b4d3527b3e957c99387482374
BLAKE2b-256 92ed316737fd689afac7811542468ad41c0baf5368410d3aed02636eb007691c

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.0.4-py36-none-any.whl
  • Upload date:
  • Size: 94.9 kB
  • Tags: Python 3.6
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.7

File hashes

Hashes for xdis-4.0.4-py36-none-any.whl
Algorithm Hash digest
SHA256 6a70b84545c1de0ca21ecf6edd36e2bfd4d9a803dcb432b4e53fde1719c30656
MD5 7b22c267d540c36ceeccb3b15bf9d5cf
BLAKE2b-256 26a49df218899b743cb1736173b10b7a258f8ee349ecaafbb49932a1e9e8c9b5

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.0.4-py35-none-any.whl
  • Upload date:
  • Size: 94.9 kB
  • Tags: Python 3.5
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.7

File hashes

Hashes for xdis-4.0.4-py35-none-any.whl
Algorithm Hash digest
SHA256 f3bd705c8721ec938ad9d302ef9a429addf3d5f58c66dc4daf81ffedb08f6585
MD5 4d843d3623a55995c17fbcf580e6a094
BLAKE2b-256 316fdadccb1c99a4d5e2cc3549ce0e02766b85cd82fefb439702b7cd04314a01

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.0.4-py34-none-any.whl
  • Upload date:
  • Size: 94.9 kB
  • Tags: Python 3.4
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.7

File hashes

Hashes for xdis-4.0.4-py34-none-any.whl
Algorithm Hash digest
SHA256 2dd5947f3c35a23a8fb765fb6436b2191b4c8d0f611ae68c5e9c087d6b66bd5e
MD5 e330d2abbe2f362b65fe8edb728b575c
BLAKE2b-256 202730343139e522998f0559fd4e9fb91ac50dedb21fe8b161da979c2bf598e3

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.0.4-py33-none-any.whl
  • Upload date:
  • Size: 90.7 kB
  • Tags: Python 3.3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.7

File hashes

Hashes for xdis-4.0.4-py33-none-any.whl
Algorithm Hash digest
SHA256 e8f68e2efd99eee0df0805e0f3c75fc9d3562f2917b4a8149250e3d62a78aa29
MD5 1a51e637c275eec8b10f56f3ae9b743f
BLAKE2b-256 15a49ce4f52aa490cbf6f5f425692e1ebcb4e441ccfe01b496f30ddc64fd0011

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.0.4-py32-none-any.whl
  • Upload date:
  • Size: 90.7 kB
  • Tags: Python 3.2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.7

File hashes

Hashes for xdis-4.0.4-py32-none-any.whl
Algorithm Hash digest
SHA256 002cca73efd98c3b5e5b95b56538c9f951262344995a3be08ce43f66f85e35cc
MD5 1716a954213dce85fb3d9bbb9f1859a9
BLAKE2b-256 e57d7c147537545019bf0c75e6c2729c46999c43e72d2931b60d3516f4d38782

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.0.4-py27-none-any.whl
  • Upload date:
  • Size: 94.9 kB
  • Tags: Python 2.7
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.7

File hashes

Hashes for xdis-4.0.4-py27-none-any.whl
Algorithm Hash digest
SHA256 f09c07c3f91f44579232c77c56d990f3417ce179f036094f02a7251ea2a08e44
MD5 f6c3be2af263469ab8301ea8b244755d
BLAKE2b-256 1838880ef36a3e009b4607e3e405d93e1078e29078ea429a9def87dc84e1f18d

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.0.4-py26-none-any.whl
  • Upload date:
  • Size: 90.7 kB
  • Tags: Python 2.6
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.7

File hashes

Hashes for xdis-4.0.4-py26-none-any.whl
Algorithm Hash digest
SHA256 537eec1348225c25e546f0e63aa71e362b9bbf6baa60ae29f3d8df1d3c0aded6
MD5 c4f39db4c0767f520631480416b965cb
BLAKE2b-256 4b80ecf9a4d32f3086deda3c4cd6bcbc37d8561641efbf6f704d93d1ed88232d

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.0.4-py3.7.egg
  • Upload date:
  • Size: 175.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.7

File hashes

Hashes for xdis-4.0.4-py3.7.egg
Algorithm Hash digest
SHA256 9ca28f4bdf49d9a3e41d44da11b5d9d3442554d93cb1d9091390f6eca333377a
MD5 c92eaf1843fcd365354953365dd4b5df
BLAKE2b-256 72b66cbe8aedce0cf5139207d62140745762479acf7901e1c8904e22e112ecb6

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.0.4-py3.6.egg
  • Upload date:
  • Size: 175.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.7

File hashes

Hashes for xdis-4.0.4-py3.6.egg
Algorithm Hash digest
SHA256 6d9da969bd36d82ddb5d15266c67ef8c2db1e4c1925830e9e47e752956614f06
MD5 c12dca0d18234536ab8d726d6fe430b2
BLAKE2b-256 2e63ff7a8c24fc1d8c423321bb8a252f852b3ed01cc0ec420377a9df77266a83

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.0.4-py3.5.egg
  • Upload date:
  • Size: 178.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.7

File hashes

Hashes for xdis-4.0.4-py3.5.egg
Algorithm Hash digest
SHA256 d3b4888632f1bd2323cfee435c5f7008ef02bc9cb6993e6ec1fd2eff46c742a1
MD5 fc2796d8c74cf5aa1468eebf58c26161
BLAKE2b-256 edcd0cc89073fe8449b735fe7e5dd2cc862e832ef7ab42d39e80ec158ddbfee9

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.0.4-py3.4.egg
  • Upload date:
  • Size: 179.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.7

File hashes

Hashes for xdis-4.0.4-py3.4.egg
Algorithm Hash digest
SHA256 23cbaf1dab4c2cb8c81d02269091db369d0ea2b8d6a03aa7511363595b02e0f4
MD5 4e08a3bb093cf26c54bbffc1f5434960
BLAKE2b-256 0d9be5fbf11ebcdb80a317aa848c95f180a164948868092682eaf242e8ee0d54

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.0.4-py3.3.egg
  • Upload date:
  • Size: 179.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.7

File hashes

Hashes for xdis-4.0.4-py3.3.egg
Algorithm Hash digest
SHA256 08042deb8fcd58d7ac6bc03e8d45f0daf0b9fab72476b71dd379f4e8812a23f8
MD5 19a762ced54a94f9cb0c7e44ea41dc5a
BLAKE2b-256 fb4adc1c046c1dca7d60835cd38bf191cbba5937741e24248253e7fd2048e43d

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.0.4-py3.2.egg
  • Upload date:
  • Size: 177.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.7

File hashes

Hashes for xdis-4.0.4-py3.2.egg
Algorithm Hash digest
SHA256 8c75454b6f1f0dc751dd899efc60b13a11e07d52a8af0456d11583d6f7b234be
MD5 4707865f8b9402014b2e6acd3d447fe5
BLAKE2b-256 7972531bf5e3e59e680b2972d9e8b006f04ea8bf193c7664817dc495d1a3ec10

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.0.4-py2.7.egg
  • Upload date:
  • Size: 175.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.7

File hashes

Hashes for xdis-4.0.4-py2.7.egg
Algorithm Hash digest
SHA256 f4aae814939849a7999f292f43af1b0deacd67dbbd4d60165489591550a53dde
MD5 86ff18c5ef0a476dab28ccf92abf221c
BLAKE2b-256 916fa1c01fab1a0f239dd13a358954e64ab086639e8d49a6bd20e4dba21adc74

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.0.4-py2.6.egg
  • Upload date:
  • Size: 175.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.7

File hashes

Hashes for xdis-4.0.4-py2.6.egg
Algorithm Hash digest
SHA256 3067ed46918748b3c962607b8a0b3e5f254fe7bcc38abb93c773ab8fd9827a17
MD5 f50fa93cbd4553b4ade5cd087236ff51
BLAKE2b-256 13fc30d6671909988ea8ba7202a389f72a1670d5077a04a1970a2f71be34b42f

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