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

Uploaded Source

Built Distributions

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

xdis-5.0.0-py37-none-any.whl (124.1 kB view details)

Uploaded Python 3.7

xdis-5.0.0-py36-none-any.whl (124.1 kB view details)

Uploaded Python 3.6

xdis-5.0.0-py35-none-any.whl (124.0 kB view details)

Uploaded Python 3.5

xdis-5.0.0-py34-none-any.whl (124.0 kB view details)

Uploaded Python 3.4

xdis-5.0.0-py33-none-any.whl (119.9 kB view details)

Uploaded Python 3.3

xdis-5.0.0-py32-none-any.whl (119.8 kB view details)

Uploaded Python 3.2

xdis-5.0.0-py27-none-any.whl (124.1 kB view details)

Uploaded Python 2.7

xdis-5.0.0-py26-none-any.whl (119.8 kB view details)

Uploaded Python 2.6

xdis-5.0.0-py3.8.egg (234.8 kB view details)

Uploaded Egg

xdis-5.0.0-py3.7.egg (234.2 kB view details)

Uploaded Egg

xdis-5.0.0-py3.6.egg (234.4 kB view details)

Uploaded Egg

xdis-5.0.0-py3.5.egg (238.5 kB view details)

Uploaded Egg

xdis-5.0.0-py3.4.egg (239.2 kB view details)

Uploaded Egg

xdis-5.0.0-py3.3.egg (240.4 kB view details)

Uploaded Egg

xdis-5.0.0-py3.2.egg (237.5 kB view details)

Uploaded Egg

xdis-5.0.0-py2.7.egg (234.9 kB view details)

Uploaded Egg

xdis-5.0.0-py2.6.egg (235.3 kB view details)

Uploaded Egg

xdis-5.0.0-py2.5.egg (245.5 kB view details)

Uploaded Egg

xdis-5.0.0-py2.4.egg (250.0 kB view details)

Uploaded Egg

File details

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

File metadata

  • Download URL: xdis-5.0.0.tar.gz
  • Upload date:
  • Size: 230.6 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-5.0.0.tar.gz
Algorithm Hash digest
SHA256 505d8350e692fce5d18f0b99ba7147d1fb15273c33fc42000dbb9bcf0615419a
MD5 7cf5dd937cfd1ff2816e7c37e2b0a24b
BLAKE2b-256 aa272501f05047933fe5ab74a2c2d11ce42e2f5466bc12f849fedf6ebf2a58ab

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-5.0.0-py37-none-any.whl
  • Upload date:
  • Size: 124.1 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-5.0.0-py37-none-any.whl
Algorithm Hash digest
SHA256 7252aeaa9cd8a1298976dd4d94999866c4898859dcb6d1c35569df36b9a053e5
MD5 91ae9d8d31c1053281a63db957a66850
BLAKE2b-256 e40f91d6a0d715911351899336821af195faadcc5c5b5ce0412b8779c560d992

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-5.0.0-py36-none-any.whl
  • Upload date:
  • Size: 124.1 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-5.0.0-py36-none-any.whl
Algorithm Hash digest
SHA256 0e7313d4e3ce7035908bdd0c6cab50ce25ac329cd0efa9df82949f2bfc7afe3e
MD5 a13c561c880c88e5193fca9712f9c6b4
BLAKE2b-256 73c0fd32638c9108d943432e5a4908b9fad1f7d7671dfcfec9bbd779904d31d6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-5.0.0-py35-none-any.whl
  • Upload date:
  • Size: 124.0 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-5.0.0-py35-none-any.whl
Algorithm Hash digest
SHA256 66ed00638df8a159e52a16ef89f03d9dd6b75d109eee5c469a4248f401bad1f9
MD5 2f15e39cf08b36510571ed2ba3bffb3c
BLAKE2b-256 52686463c42f7c28519723d3b8ff2fa7815bab6ecb92a0c8b09b4dc167c21225

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-5.0.0-py34-none-any.whl
  • Upload date:
  • Size: 124.0 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-5.0.0-py34-none-any.whl
Algorithm Hash digest
SHA256 3742d077bcf09a714837dd2c537e443a5e01e551e02ec05d42345f1febe11020
MD5 ddd5acdc3de0f773d769d96185c58df1
BLAKE2b-256 517524740ca833cbe3fe0d44c43ee542ac316a21aba7f968ebd25dcff9d2a341

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-5.0.0-py33-none-any.whl
  • Upload date:
  • Size: 119.9 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-5.0.0-py33-none-any.whl
Algorithm Hash digest
SHA256 a617a65f19868c4d4be8300c05b708a88315be4bbe4142fbfe7301a31fd05484
MD5 11b54b77d482a4a5d0c2287e40968feb
BLAKE2b-256 9d0c70b5932cdf2817d2eac3243edd6f5f829f6ea271ee03837732ca6dba0f80

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-5.0.0-py32-none-any.whl
  • Upload date:
  • Size: 119.8 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-5.0.0-py32-none-any.whl
Algorithm Hash digest
SHA256 8259087e35151f452bd0dd808be5399c9c1f0f5d698f4ed2850961a325a8b349
MD5 fb118bcf1aee317089d3676ebd5f4976
BLAKE2b-256 ecaa40897e47d2c14c0761eb0eb666fe0fb1f4769eca4e026ca064486f4dc654

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-5.0.0-py27-none-any.whl
  • Upload date:
  • Size: 124.1 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-5.0.0-py27-none-any.whl
Algorithm Hash digest
SHA256 1964e2bc6a536821a367ebbcbebc4c5df495d4031f13758c7bf4e9b19478875a
MD5 61031ef4c824b790faec2384d92f70ed
BLAKE2b-256 388af0958fe617855b7f2da21a4c32080a9ee54f2dccc435fb00d9e0bb460756

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-5.0.0-py26-none-any.whl
  • Upload date:
  • Size: 119.8 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-5.0.0-py26-none-any.whl
Algorithm Hash digest
SHA256 3503a354ea55b50caac7597b6bc1dafd9a3be9483b8a90f6e20ce59e7919b336
MD5 0f5407103e644ae8fc9e908e7910e644
BLAKE2b-256 fd5a315ab9f2ad97e4d3100246d7e0d47d8673eca371a6c30b8b4c8a6edde739

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-5.0.0-py3.8.egg
  • Upload date:
  • Size: 234.8 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-5.0.0-py3.8.egg
Algorithm Hash digest
SHA256 7e304719c94eb66e8b004d9c64c1ca44daaf86c64c05fbc1033f19ab9abd2840
MD5 a61c8ed63ae74d14d8dc7748743b3b52
BLAKE2b-256 82983e492ab3f69be4be411763741f8a1bb5955182290efc846e2a29742ab8f4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-5.0.0-py3.7.egg
  • Upload date:
  • Size: 234.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-5.0.0-py3.7.egg
Algorithm Hash digest
SHA256 e9dc000051da2f565de8800db54f6500fd3eca0586d135d5537b7271763108e6
MD5 ff52cbeb43be9e7cebf8b7c15437e7d5
BLAKE2b-256 b93e2c8ace32187abcfbfb0a1301c34b567205726198608690c0e462c63f1522

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-5.0.0-py3.6.egg
  • Upload date:
  • Size: 234.4 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-5.0.0-py3.6.egg
Algorithm Hash digest
SHA256 4e0f5795ca2529fe56c9ec31fa08c9eac1270a4f37f5190b80c57d8b8a622022
MD5 5b85098f227cd19bdae21e8a7f6232d1
BLAKE2b-256 5c31c26625d4f17d9116794977c775aeba071cd2f996c5f8c6bfa3d2d95abd3c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-5.0.0-py3.5.egg
  • Upload date:
  • Size: 238.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-5.0.0-py3.5.egg
Algorithm Hash digest
SHA256 e9db6f89d5e3daa133d105a3ed162c475d8eb0c1cd7a842daf5a8ffffdb3f430
MD5 0988ced875b0611fc5fed520e23f79d9
BLAKE2b-256 842f11d7203daeeb5daad300b35dee2d1c3ae9e5141d43bf5f7ed29e195a5e03

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-5.0.0-py3.4.egg
  • Upload date:
  • Size: 239.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-5.0.0-py3.4.egg
Algorithm Hash digest
SHA256 ec96e9cacaba174103f212dcb26027912a3e5bc2c40cbf324a8eca287b3ae5ca
MD5 897083a352b226dcfb253edda3e0eac1
BLAKE2b-256 443eb84506c9308cfd05a7baf95471ad4bacfb5d8aee896393d919d49b82600c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-5.0.0-py3.3.egg
  • Upload date:
  • Size: 240.4 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-5.0.0-py3.3.egg
Algorithm Hash digest
SHA256 ebcf1e663b8763886ea4624480a68db24686d807b0aed548ea736ccabe6b236c
MD5 7ea6e84d703ad6f4b14c9c700d19c9d8
BLAKE2b-256 a72d30716ebd94e573b8014e5f6f1ef9d425e6885670b8577c208febf18e212c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-5.0.0-py3.2.egg
  • Upload date:
  • Size: 237.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-5.0.0-py3.2.egg
Algorithm Hash digest
SHA256 6ce5215d33a49ca6961bdd3ccd62efeb9cac91407467f1668e233a6871c04cd3
MD5 d84e1b4e69bc28b1e8d45c90054d58f9
BLAKE2b-256 80f5a7d050c74467a962c30ac8139745fe863db1d2a65239c83b14b8c721b892

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-5.0.0-py2.7.egg
  • Upload date:
  • Size: 234.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-5.0.0-py2.7.egg
Algorithm Hash digest
SHA256 6f552be1ce23bdaa00b041bcc8407a40e65eaaf72d5d757fc317eac937aa6d83
MD5 0b454ec7cfd2a92b631a9e74ccb5fdf2
BLAKE2b-256 c5314dcd3d1346063fb7f5f4f07cc46b8afc907899fa31e182d93da2a2eae4e1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-5.0.0-py2.6.egg
  • Upload date:
  • Size: 235.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-5.0.0-py2.6.egg
Algorithm Hash digest
SHA256 b5f900c9839d1aba70706d26fa274035b842462d539fc719bf1e2aea71b5f61d
MD5 afb39089a80efaebad17900ed18cc80e
BLAKE2b-256 ca1da0e86ed50bc9ac46308db1639803a57fa7d1a8c873a25f27c177c2b4eb4a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-5.0.0-py2.5.egg
  • Upload date:
  • Size: 245.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-5.0.0-py2.5.egg
Algorithm Hash digest
SHA256 95cc6ab1e126d2a625ff5a503354e43b7460a16cf71b43225f21060bae3bc4c7
MD5 aa1cc5babcd04fff126ab0b6ec581db6
BLAKE2b-256 77edd613b189b0e7974e8429e419dddd43a044b1781490ccfcf0ea44a56ed413

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-5.0.0-py2.4.egg
  • Upload date:
  • Size: 250.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-5.0.0-py2.4.egg
Algorithm Hash digest
SHA256 5068f6bf0a1d5f5a331d81b1316e9ccebc826fe7c7166deb1b05bbabe292b9bb
MD5 43ce1a2c2019c0da879af620c1e4374f
BLAKE2b-256 cce634db356074b7a09c7208f0ea98c6dad0be80b5cc847a987acf3612ccd4a0

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