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.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-4.1.1.tar.gz (196.8 kB view details)

Uploaded Source

Built Distributions

xdis-4.1.1-py37-none-any.whl (98.7 kB view details)

Uploaded Python 3.7

xdis-4.1.1-py36-none-any.whl (98.7 kB view details)

Uploaded Python 3.6

xdis-4.1.1-py35-none-any.whl (98.7 kB view details)

Uploaded Python 3.5

xdis-4.1.1-py34-none-any.whl (98.7 kB view details)

Uploaded Python 3.4

xdis-4.1.1-py33-none-any.whl (94.4 kB view details)

Uploaded Python 3.3

xdis-4.1.1-py27-none-any.whl (98.7 kB view details)

Uploaded Python 2.7

xdis-4.1.1-py26-none-any.whl (94.4 kB view details)

Uploaded Python 2.6

xdis-4.1.1-py3.7.egg (182.7 kB view details)

Uploaded Source

xdis-4.1.1-py3.6.egg (182.7 kB view details)

Uploaded Source

xdis-4.1.1-py3.5.egg (185.8 kB view details)

Uploaded Source

xdis-4.1.1-py3.4.egg (186.2 kB view details)

Uploaded Source

xdis-4.1.1-py3.3.egg (187.1 kB view details)

Uploaded Source

xdis-4.1.1-py2.7.egg (182.5 kB view details)

Uploaded Source

xdis-4.1.1-py2.6.egg (182.8 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: xdis-4.1.1.tar.gz
  • Upload date:
  • Size: 196.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.5

File hashes

Hashes for xdis-4.1.1.tar.gz
Algorithm Hash digest
SHA256 9f2bbeea2b51714bc6e2c85c6bc8d8a2f47402bd5970aa49709354e12b55d155
MD5 2b224a8f99f5c3ddadc84caa5125284a
BLAKE2b-256 b2be3f29da5ca4a13e0eb1b9b5c63ed71364f3fc4d1cf6dfbea23aefa66b7737

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.1.1-py37-none-any.whl
  • Upload date:
  • Size: 98.7 kB
  • Tags: Python 3.7
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.5

File hashes

Hashes for xdis-4.1.1-py37-none-any.whl
Algorithm Hash digest
SHA256 9c4fbbfbb37c0c4106ec76fb688514f4556ee1c25636542b1472c39894154ba2
MD5 e0eb3995f2af5797ffa99fa149141308
BLAKE2b-256 c146119942374ab942766394f3bf865d001ad1f73283cf9c4e5b4537ab276e02

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.1.1-py36-none-any.whl
  • Upload date:
  • Size: 98.7 kB
  • Tags: Python 3.6
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.5

File hashes

Hashes for xdis-4.1.1-py36-none-any.whl
Algorithm Hash digest
SHA256 3c62dd8580c9bbae7b0bb19b0250d02ad01a970c78c51070cb48f39b296698a9
MD5 4f5b6c260af208dffad2f4d27c60ccf4
BLAKE2b-256 671a1fae51cf82a13da95b04d57a2fa79756179da00cd38193418df612012f25

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.1.1-py35-none-any.whl
  • Upload date:
  • Size: 98.7 kB
  • Tags: Python 3.5
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.5

File hashes

Hashes for xdis-4.1.1-py35-none-any.whl
Algorithm Hash digest
SHA256 4e9fcd3b3d9325efa3e5a29deb02d5225afdcca52b1ee6ebf36a70f76e9feee2
MD5 125efc8005328246aed3f4bab13a4cf6
BLAKE2b-256 312c7ab8d4e75f287ee752e388069f605b8c58ab40a8dbec7f2a907c734cabf0

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.1.1-py34-none-any.whl
  • Upload date:
  • Size: 98.7 kB
  • Tags: Python 3.4
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.5

File hashes

Hashes for xdis-4.1.1-py34-none-any.whl
Algorithm Hash digest
SHA256 45c330be8682167abc5eb3ae1cea7a6e261b7a9226868517ad357e9f2457958f
MD5 72bf517b2572a86559d911e0b89741aa
BLAKE2b-256 b3713533d310bc0cb85dd208fc4dcd237ee6f9f0695b85ec8bb74280ffd11db6

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.1.1-py33-none-any.whl
  • Upload date:
  • Size: 94.4 kB
  • Tags: Python 3.3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.5

File hashes

Hashes for xdis-4.1.1-py33-none-any.whl
Algorithm Hash digest
SHA256 04318c6b98d490e9a259f5f2035a5f31037e599523e8e0eede19ed620a823d6e
MD5 9c55a87100acb010bf6a778f47b9d642
BLAKE2b-256 2631c5dd53da2bdd069dd18416890fc221fb9a518daf8f24ab2d7e8ba0bd6085

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.1.1-py27-none-any.whl
  • Upload date:
  • Size: 98.7 kB
  • Tags: Python 2.7
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.5

File hashes

Hashes for xdis-4.1.1-py27-none-any.whl
Algorithm Hash digest
SHA256 80368cada298649f80cad9a4f34c75a8449b7a243919325c7aebd1aee5f50b1e
MD5 ecbaa179d8c9ed2f1f31740135e1b663
BLAKE2b-256 969523612fef5f8cc0128dd5c1b8f7379fddc306f67a4dca19cf3435cad5d2f3

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.1.1-py26-none-any.whl
  • Upload date:
  • Size: 94.4 kB
  • Tags: Python 2.6
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.5

File hashes

Hashes for xdis-4.1.1-py26-none-any.whl
Algorithm Hash digest
SHA256 e503c88d92480b34934da29d64fcc816e53e2a8788171ba97f3ffcefb81ac3c8
MD5 a5ad9afdb051fa342bcc6fbbde16b8d7
BLAKE2b-256 eef6198215ba03693a15330ebc1e0502ace2f66164c5862d3a3d12f7d2c27a2e

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.1.1-py3.7.egg
  • Upload date:
  • Size: 182.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.5

File hashes

Hashes for xdis-4.1.1-py3.7.egg
Algorithm Hash digest
SHA256 6c1e075209ea9bd0b1c0677f60b67b65fa5c318652c908983ee1ba2db73b15ac
MD5 4ada700848ea79269963b02a97d62f84
BLAKE2b-256 461d09c85279e1eefa9819a0be1848498c385a4589445f6c0e84d24be714b9be

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.1.1-py3.6.egg
  • Upload date:
  • Size: 182.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.5

File hashes

Hashes for xdis-4.1.1-py3.6.egg
Algorithm Hash digest
SHA256 a32b998cf726ad056499f1135613061b442fc2e00a56b4a42cba4244c23abea4
MD5 0db9b5df8d5bfbed1f8236ef9cadaa32
BLAKE2b-256 afaf9d27b0535c0953a9e2e5bf63c0d40fb4a860feaa713f9b75c8a510c718b2

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.1.1-py3.5.egg
  • Upload date:
  • Size: 185.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.5

File hashes

Hashes for xdis-4.1.1-py3.5.egg
Algorithm Hash digest
SHA256 9d575e896680516aa2ba03673f5a67dbf834f4cb211cc7fe0ae660b44bfea9ea
MD5 b63b55187073e58fa7d85ab65b8af7db
BLAKE2b-256 89aa5acda75785c9853b8a9b94ee535fdc9820fbd3b68815148e5692d6a87cd0

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.1.1-py3.4.egg
  • Upload date:
  • Size: 186.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.5

File hashes

Hashes for xdis-4.1.1-py3.4.egg
Algorithm Hash digest
SHA256 5248a8a2733a73e5d2b29a0d5ac4e5c2470bf1de890c954d19538d68043983c9
MD5 0141444c3c4451630dbb74513b516205
BLAKE2b-256 092af2c1c7a27f2fd87acd6e8c47f738241a15fa705cbc9ac25dcccff02a1d72

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.1.1-py3.3.egg
  • Upload date:
  • Size: 187.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.5

File hashes

Hashes for xdis-4.1.1-py3.3.egg
Algorithm Hash digest
SHA256 f581ee9475726c6c737cbd20af0a790516f2fa129fee329ff89f22651608bc6f
MD5 2428c70afe2e7b83cd79d52ab8e686f1
BLAKE2b-256 a574db29fb5905375afcd0d957f3cd4980a93a3babb72fffd17f2ac0124b02bc

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.1.1-py2.7.egg
  • Upload date:
  • Size: 182.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.5

File hashes

Hashes for xdis-4.1.1-py2.7.egg
Algorithm Hash digest
SHA256 d6304a4ceb76a2de08a8c8508a724ea62e3560b856a8997b7c65a75363352e82
MD5 13e402a103f05b3d316ee184289fb009
BLAKE2b-256 2d100ab878ef131bf1d17ef33e5dec23931818153c8ececc5a5266f97054afc1

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.1.1-py2.6.egg
  • Upload date:
  • Size: 182.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.5

File hashes

Hashes for xdis-4.1.1-py2.6.egg
Algorithm Hash digest
SHA256 e9be2831ed52860b38d693e0841cb7e606e9049affb4f9b0c8357d06eefecac0
MD5 2cc6f133d3021212ef3898fb8ec92de2
BLAKE2b-256 ade3cdd88fddfc86f72a167c90b6eb3c1a6ef1f086c7281ff9076faa1641af6c

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