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

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

Uploaded Source

Built Distributions

xdis-5.0.7-py3.9.egg (240.6 kB view details)

Uploaded Source

xdis-5.0.7-py3.8.egg (240.8 kB view details)

Uploaded Source

xdis-5.0.7-py3.7.egg (240.2 kB view details)

Uploaded Source

xdis-5.0.7-py3.6.egg (240.4 kB view details)

Uploaded Source

xdis-5.0.7-py3.4.egg (245.5 kB view details)

Uploaded Source

xdis-5.0.7-py3.3.egg (246.9 kB view details)

Uploaded Source

xdis-5.0.7-py3.2.egg (244.0 kB view details)

Uploaded Source

xdis-5.0.7-py2.py3-none-any.whl (126.8 kB view details)

Uploaded Python 2 Python 3

xdis-5.0.7-py2.7.egg (241.5 kB view details)

Uploaded Source

xdis-5.0.7-py2.6.egg (241.9 kB view details)

Uploaded Source

xdis-5.0.7-py2.5.egg (250.3 kB view details)

Uploaded Source

xdis-5.0.7-py2.4.egg (255.0 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: xdis-5.0.7.tar.gz
  • Upload date:
  • Size: 233.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for xdis-5.0.7.tar.gz
Algorithm Hash digest
SHA256 4de95534c1096609be6950061ea25ffb4ecb89dbaca7469de4f9e2e4ee46a0ca
MD5 9b50cfcce160a30ef3d1f63f2444c336
BLAKE2b-256 a1099f70b537e9e964e23fdbe06fbf946a8463a7870ce9d1c06420e913d0f058

See more details on using hashes here.

Provenance

File details

Details for the file xdis-5.0.7-py3.9.egg.

File metadata

  • Download URL: xdis-5.0.7-py3.9.egg
  • Upload date:
  • Size: 240.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for xdis-5.0.7-py3.9.egg
Algorithm Hash digest
SHA256 7260357fcc8f16b4fddc7d03d4efa01f48fe6d94674e145830a84a7d8a4ee3f8
MD5 35c104557fb8a9a650a9bd4fe15177f2
BLAKE2b-256 7d3ed4e6f48ee2df88a20b955e8ab12cb07d1de32498496750fb0030baad56b9

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-5.0.7-py3.8.egg
  • Upload date:
  • Size: 240.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for xdis-5.0.7-py3.8.egg
Algorithm Hash digest
SHA256 d014af04ffbff6a59f89b3ecb02395bb0c03a075ca04e7c00bd74b1a11470f94
MD5 a3ca477a1325a48f03f3ec68a518feef
BLAKE2b-256 756cea843ed1d43d59c9aba6318ecd112a13561269fdd5140bedf64c06dbbebf

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-5.0.7-py3.7.egg
  • Upload date:
  • Size: 240.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for xdis-5.0.7-py3.7.egg
Algorithm Hash digest
SHA256 ebc18fcdf94c4e738bed2d375dbffb4a4432a7c3e31898c379ed2dc81e8e61cc
MD5 32e32b41556e17477934e4dcddac9a10
BLAKE2b-256 2c682ac0eb27e0cf91e2ba37778791028c3eef0201c2399bbe9fc301588a4d0b

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-5.0.7-py3.6.egg
  • Upload date:
  • Size: 240.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for xdis-5.0.7-py3.6.egg
Algorithm Hash digest
SHA256 bfa191b97492598f1f8e0013b8b3785be2a81d664658eeec82a1ce8e3760af0b
MD5 50cd8eee4779ae89916f253be6ee50dc
BLAKE2b-256 f8e88d8938c058d5dbabedb8373fe7a339f6e8d38a88e1dc400db8f79a2d296c

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-5.0.7-py3.4.egg
  • Upload date:
  • Size: 245.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for xdis-5.0.7-py3.4.egg
Algorithm Hash digest
SHA256 0e96049dd45c36b786461f149033358d0b07eb803344cd0e0f077052d7d9e5e0
MD5 9a32f81fa4f5497706baec12b11d2b6b
BLAKE2b-256 3357f35f605297a9933b7a194b3677fbdfb0431ac2d8642e988a756305afa5ad

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-5.0.7-py3.3.egg
  • Upload date:
  • Size: 246.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for xdis-5.0.7-py3.3.egg
Algorithm Hash digest
SHA256 1b59955510259c9347d0544ec891346ee1d0520cddc962555ddd1545c13f9b68
MD5 2c98bd4049a998839edfdccd6e378abf
BLAKE2b-256 842a7207c2063023c5224c27c6a31e114e045a52a3d1a74ca6ad55c58dced1ac

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-5.0.7-py3.2.egg
  • Upload date:
  • Size: 244.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for xdis-5.0.7-py3.2.egg
Algorithm Hash digest
SHA256 b2891454567ca567318e6a104210f8e500a2dc2c8de41ea6a99558dcbaa1a7e8
MD5 93c321abba556f56176f7f6c4a440c6f
BLAKE2b-256 9c51b77fff1f86f01ae81f06383b464f784eb4caa565007331a63b327957a5b5

See more details on using hashes here.

Provenance

File details

Details for the file xdis-5.0.7-py2.py3-none-any.whl.

File metadata

  • Download URL: xdis-5.0.7-py2.py3-none-any.whl
  • Upload date:
  • Size: 126.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for xdis-5.0.7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bee8f43124428a3cca89a598aef51a9fc5e744556d815507eb0ba65088b7f777
MD5 0e15119d48bf6edbda53678430334bcc
BLAKE2b-256 341dfe29f1ccbdf06d8a3fe600aeb64efa7ba3798766f33c594971d870f13a8f

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-5.0.7-py2.7.egg
  • Upload date:
  • Size: 241.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for xdis-5.0.7-py2.7.egg
Algorithm Hash digest
SHA256 cc90ec38ba7dd6dbd5a4ccd71f48864064a06ef0e128ada9f5c423a345559558
MD5 a9b38a6a67a4e0f388679335f0607407
BLAKE2b-256 ca3d55331610f52f5d5e29e6d811367dde63707a3853fb0d54b5105c81ef6834

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-5.0.7-py2.6.egg
  • Upload date:
  • Size: 241.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for xdis-5.0.7-py2.6.egg
Algorithm Hash digest
SHA256 e553b794edbb74c31380e0a6eec8b33c798182b2f98b9c8aed799561b7aa1440
MD5 870f82c1dcc77b50fb503b85e045fe2b
BLAKE2b-256 cc339db0e5e06fd02cc9e79db618ae63e0b0771768cf8147b9ff13494dccb5ae

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-5.0.7-py2.5.egg
  • Upload date:
  • Size: 250.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for xdis-5.0.7-py2.5.egg
Algorithm Hash digest
SHA256 324129f2d089ff5dcee9031f596e6699693a90ba2082702aaa23a01edd159e32
MD5 e160e0338491217cb2ed6d1fe637c97f
BLAKE2b-256 ee76dd0efe0f588c95822cc8c9599a98f5eb3108e41a32034c1636fbd3295c37

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-5.0.7-py2.4.egg
  • Upload date:
  • Size: 255.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for xdis-5.0.7-py2.4.egg
Algorithm Hash digest
SHA256 47562759968ec6753ae2411465276231c9a11582d8cf67eefde66eeb339f0336
MD5 7893a3cb79cf11a9d223f611db508aee
BLAKE2b-256 b8ee0bb719abcc4d634f398ed0f72cac9074b92758498b0728c8171810a5f62a

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