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 isassembler, 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-4.6.0.tar.gz (224.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

xdis-4.6.0-py37-none-any.whl (117.2 kB view details)

Uploaded Python 3.7

xdis-4.6.0-py36-none-any.whl (117.2 kB view details)

Uploaded Python 3.6

xdis-4.6.0-py35-none-any.whl (117.2 kB view details)

Uploaded Python 3.5

xdis-4.6.0-py34-none-any.whl (117.2 kB view details)

Uploaded Python 3.4

xdis-4.6.0-py33-none-any.whl (113.0 kB view details)

Uploaded Python 3.3

xdis-4.6.0-py32-none-any.whl (113.0 kB view details)

Uploaded Python 3.2

xdis-4.6.0-py27-none-any.whl (117.2 kB view details)

Uploaded Python 2.7

xdis-4.6.0-py26-none-any.whl (113.0 kB view details)

Uploaded Python 2.6

xdis-4.6.0-py3.8.egg (219.6 kB view details)

Uploaded Egg

xdis-4.6.0-py3.7.egg (219.0 kB view details)

Uploaded Egg

xdis-4.6.0-py3.6.egg (219.1 kB view details)

Uploaded Egg

xdis-4.6.0-py3.5.egg (222.9 kB view details)

Uploaded Egg

xdis-4.6.0-py3.4.egg (223.5 kB view details)

Uploaded Egg

xdis-4.6.0-py3.3.egg (224.6 kB view details)

Uploaded Egg

xdis-4.6.0-py3.2.egg (221.9 kB view details)

Uploaded Egg

xdis-4.6.0-py2.7.egg (219.2 kB view details)

Uploaded Egg

xdis-4.6.0-py2.6.egg (219.5 kB view details)

Uploaded Egg

xdis-4.6.0-py2.5.egg (229.3 kB view details)

Uploaded Egg

xdis-4.6.0-py2.4.egg (233.2 kB view details)

Uploaded Egg

File details

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

File metadata

  • Download URL: xdis-4.6.0.tar.gz
  • Upload date:
  • Size: 224.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for xdis-4.6.0.tar.gz
Algorithm Hash digest
SHA256 d4cad319d3ea644ea7b9f8c8b45440263e7bf8e02a5a8c3f546a6ff27d1b3de1
MD5 2a1f2992108f76304beca5b618948723
BLAKE2b-256 48035532df8f712a8ce07dd512c9c8aef651839e57129997cec21a791d5dfd21

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.6.0-py37-none-any.whl
  • Upload date:
  • Size: 117.2 kB
  • Tags: Python 3.7
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for xdis-4.6.0-py37-none-any.whl
Algorithm Hash digest
SHA256 e514d258fc60ede30663693767d6e6ac108ff285e92ef32105e26286b273d33d
MD5 73fdaff9946890b8d4bb7c14c77f9963
BLAKE2b-256 59a713c133fc4f132d564b4fdcb686502c103458ba62a983d3ccd60d4554a4e4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.6.0-py36-none-any.whl
  • Upload date:
  • Size: 117.2 kB
  • Tags: Python 3.6
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for xdis-4.6.0-py36-none-any.whl
Algorithm Hash digest
SHA256 9a4800e159ea3aa7a110d96e6e2dcc996586912169bc018359686e926ff4cddb
MD5 892d36eb403811a59bd8fffc481fb4e6
BLAKE2b-256 b59b29b0c203ee210fe043d6f36ad78454fd41c64de9263cc49e97db1812b8bc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.6.0-py35-none-any.whl
  • Upload date:
  • Size: 117.2 kB
  • Tags: Python 3.5
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for xdis-4.6.0-py35-none-any.whl
Algorithm Hash digest
SHA256 607bc005f236fdaa6ed8e53293c63f4270aac24c63e52f4abe572d814899cb64
MD5 8ac25a5611f93bb2b97a57bcaa932beb
BLAKE2b-256 34f7fc4d6614ae9dcb21e73f814bacf0d8f0362542725ad2d0b456da48cdda6f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.6.0-py34-none-any.whl
  • Upload date:
  • Size: 117.2 kB
  • Tags: Python 3.4
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for xdis-4.6.0-py34-none-any.whl
Algorithm Hash digest
SHA256 ad9b8e95dfe112c977bf42a124108fa87b02a6b697dc944f573463f97a6cad72
MD5 35b5daf4402c659c6f59289609974e7e
BLAKE2b-256 1bc47c524a1fe4b3fed63b130ccebf9a40726a2fb0db52134a0035ec996f8711

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.6.0-py33-none-any.whl
  • Upload date:
  • Size: 113.0 kB
  • Tags: Python 3.3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for xdis-4.6.0-py33-none-any.whl
Algorithm Hash digest
SHA256 9db883f612e95094941baed5dde78a87af75d7416001739b29b33b383717d915
MD5 f58b7769aa77a41d7b1ef75994642745
BLAKE2b-256 ddfa30a3a01dd463a5c1fc1051c7c8244894f9f5f05b6f8498cb96014440a4af

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.6.0-py32-none-any.whl
  • Upload date:
  • Size: 113.0 kB
  • Tags: Python 3.2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for xdis-4.6.0-py32-none-any.whl
Algorithm Hash digest
SHA256 ef78d9fbd4c6e9efc90dd66d4506ec1ed864800b6130f6578e5f1d73c0e3bc24
MD5 b77c68d84df591e12a0327e80e879c7b
BLAKE2b-256 a8e09a0c65edd4fd4af12cbf4e29a7b0dae0a11b454feabf8f44545f6d23e658

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.6.0-py27-none-any.whl
  • Upload date:
  • Size: 117.2 kB
  • Tags: Python 2.7
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for xdis-4.6.0-py27-none-any.whl
Algorithm Hash digest
SHA256 eaa64efedfb000bf0b1cd10f3dc23b9ad209ec2d46346fc5ec7f6cd3235d83ad
MD5 7b6ec188ff08ffe020de64880385fe4a
BLAKE2b-256 0b835c63a821103a89e19d88a504029c68fffbd1a914dc900b1491cdf68ead52

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.6.0-py26-none-any.whl
  • Upload date:
  • Size: 113.0 kB
  • Tags: Python 2.6
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for xdis-4.6.0-py26-none-any.whl
Algorithm Hash digest
SHA256 e8fdd3178775e8031bcc9b6131c88f50b8a7521237ab3a03218eb1a4d8467163
MD5 a6871fbbbed5bd5e23e99f8f97467b93
BLAKE2b-256 0ceb77c261a620e8a2b53e6bfc303468c245f7e09134f062bda06a28af459cba

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.6.0-py3.8.egg
  • Upload date:
  • Size: 219.6 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for xdis-4.6.0-py3.8.egg
Algorithm Hash digest
SHA256 59977c47a3249d2adad4203cc30ec39c203d669a42297ea0b540449975e22485
MD5 2b70efdb2b710b2f81eba37aa25204e6
BLAKE2b-256 41e52db7e464a72b68b783f42fdf47c351414815604ddf5b7119ab07c40641e4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.6.0-py3.7.egg
  • Upload date:
  • Size: 219.0 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for xdis-4.6.0-py3.7.egg
Algorithm Hash digest
SHA256 2ee737ea99b736e20f2fdf6b18cbe7d251ba463af9a69685af3b6ab4ad8a0b94
MD5 30e48b6ccc473b874c68b5cdee4a1881
BLAKE2b-256 88c30a990ed41ea7924d0929acab5d05662ef81ea61862a9dc8b4cd06c29a374

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.6.0-py3.6.egg
  • Upload date:
  • Size: 219.1 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for xdis-4.6.0-py3.6.egg
Algorithm Hash digest
SHA256 edff940bab702703c65ac90d57e9651fa2130e2a13ff247d100ee1af57fcbaca
MD5 656ddb0938a406c2b5c012fe21b32dfa
BLAKE2b-256 b19f3cf033a4e66670c53b450db140be0f4a95df0f52efa4989bbdef087bd51d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.6.0-py3.5.egg
  • Upload date:
  • Size: 222.9 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for xdis-4.6.0-py3.5.egg
Algorithm Hash digest
SHA256 caec535bd254c1d9053c86752980a1543acb6b7f75c96b9fcdec9a34884bad22
MD5 2a7e4ec55f32f067735a730da88cec5b
BLAKE2b-256 98eede5d2ad4212abea3ab5013f099c51dfdee49f3aacf6c1e6889f228a79854

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.6.0-py3.4.egg
  • Upload date:
  • Size: 223.5 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for xdis-4.6.0-py3.4.egg
Algorithm Hash digest
SHA256 caf94807bbed7e0f875536f2b63141b220fdcb6e4d4df77b473065aa94250340
MD5 32d431bc83827a9d7c827cb98cfb5fa5
BLAKE2b-256 88053082969dd8be983b4fb2d1eec9f06a0d21a102760b4e845c4234471d0372

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.6.0-py3.3.egg
  • Upload date:
  • Size: 224.6 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for xdis-4.6.0-py3.3.egg
Algorithm Hash digest
SHA256 922c75432ecfd7421935b17a60689cc3a529e730c580b337d8cd2478a0b5b957
MD5 6f4eaf7e421683bb0cdb9a6783ca1766
BLAKE2b-256 672fafe5e7f973e2f7a86187a5e5a128826aaa1d1e7c933c60ba56629b1b68a6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.6.0-py3.2.egg
  • Upload date:
  • Size: 221.9 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for xdis-4.6.0-py3.2.egg
Algorithm Hash digest
SHA256 c8c63433c8c950dfd52d4f333e6985bddaf9c77d7b23e0c119161719ff1b12cc
MD5 6585ef73e492b81485895d5fdfb7cf6e
BLAKE2b-256 13d83e1374f89d43444ee3cf041f46036e5deced75c8b9f835d6b88d74093d41

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.6.0-py2.7.egg
  • Upload date:
  • Size: 219.2 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for xdis-4.6.0-py2.7.egg
Algorithm Hash digest
SHA256 45ae6345d1aafa90b62812d15912b3869e13a5d70896c51e29156bbc29f63e15
MD5 3f6c96426f043cc71f3ef02d999f6e7a
BLAKE2b-256 92da5e68d383cb003baac63cb7470f074db204f57b52ef5956920874e20520dd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.6.0-py2.6.egg
  • Upload date:
  • Size: 219.5 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for xdis-4.6.0-py2.6.egg
Algorithm Hash digest
SHA256 e8c717f87489ef0d89f7762a5ad25d9339a2e97f0a912c44f994b1e8a7f8c390
MD5 375087885c8f71bf76cfcf7de197e3f8
BLAKE2b-256 3a259aea46c11616261eaf9bc52ad8579ea3fa335b1c95ffbcb875844c674b71

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.6.0-py2.5.egg
  • Upload date:
  • Size: 229.3 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for xdis-4.6.0-py2.5.egg
Algorithm Hash digest
SHA256 e694c283e2543a19838664064b8e175bfb0396ff8898e703deea6d25f2855653
MD5 9fc705024afa9b66cd4b82df932a71dd
BLAKE2b-256 aa5e0406b77baa749bd5fcdaffa7c95ddc8df4a8885a965d8c12af73466b92f8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.6.0-py2.4.egg
  • Upload date:
  • Size: 233.2 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for xdis-4.6.0-py2.4.egg
Algorithm Hash digest
SHA256 e877be3bd0897d1ad49fbef0bc33d0b2cb8776f66a3491711d13cd0022d4ff48
MD5 b0cd5adb68848b0339c07d1e19e2eed6
BLAKE2b-256 d87d177c19cfa7fcf76fd7a237fff169aaa59fbd63d23e9ecd102da686a17aa1

See more details on using hashes here.

Supported by

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