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

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

Uploaded Source

Built Distributions

xdis-4.2.1-py37-none-any.whl (100.5 kB view details)

Uploaded Python 3.7

xdis-4.2.1-py36-none-any.whl (100.5 kB view details)

Uploaded Python 3.6

xdis-4.2.1-py35-none-any.whl (100.5 kB view details)

Uploaded Python 3.5

xdis-4.2.1-py34-none-any.whl (100.5 kB view details)

Uploaded Python 3.4

xdis-4.2.1-py33-none-any.whl (96.3 kB view details)

Uploaded Python 3.3

xdis-4.2.1-py32-none-any.whl (96.3 kB view details)

Uploaded Python 3.2

xdis-4.2.1-py27-none-any.whl (100.5 kB view details)

Uploaded Python 2.7

xdis-4.2.1-py26-none-any.whl (96.3 kB view details)

Uploaded Python 2.6

xdis-4.2.1-py3.8.egg (186.8 kB view details)

Uploaded Source

xdis-4.2.1-py3.7.egg (186.3 kB view details)

Uploaded Source

xdis-4.2.1-py3.6.egg (186.3 kB view details)

Uploaded Source

xdis-4.2.1-py3.5.egg (189.4 kB view details)

Uploaded Source

xdis-4.2.1-py3.4.egg (189.9 kB view details)

Uploaded Source

xdis-4.2.1-py3.3.egg (190.8 kB view details)

Uploaded Source

xdis-4.2.1-py3.2.egg (188.3 kB view details)

Uploaded Source

xdis-4.2.1-py2.7.egg (186.1 kB view details)

Uploaded Source

xdis-4.2.1-py2.6.egg (186.4 kB view details)

Uploaded Source

xdis-4.2.1-py2.5.egg (196.7 kB view details)

Uploaded Source

xdis-4.2.1-py2.4.egg (199.9 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: xdis-4.2.1.tar.gz
  • Upload date:
  • Size: 204.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.8.0

File hashes

Hashes for xdis-4.2.1.tar.gz
Algorithm Hash digest
SHA256 7d906c9ff8d2210920ea4b6f864f079336365e9ade7255f0fd2272542f58ead2
MD5 3b35fcd915c9d49a5d5f793321099185
BLAKE2b-256 2fe18474a77c98928a845e07eef6e84d83c2c09e6515cee84abeb5415ac02423

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.2.1-py37-none-any.whl
  • Upload date:
  • Size: 100.5 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.8.0

File hashes

Hashes for xdis-4.2.1-py37-none-any.whl
Algorithm Hash digest
SHA256 b5bea3ae5bba277d0d525f6c6a9465eda71fd7342d6ce4880df472f2fd4d901b
MD5 1be361856854b94f72bdf926158fe898
BLAKE2b-256 b2a0f997e983f59906c6ed7107a0a081eafd6d73f4d66fa009664881cc0bdf38

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.2.1-py36-none-any.whl
  • Upload date:
  • Size: 100.5 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.8.0

File hashes

Hashes for xdis-4.2.1-py36-none-any.whl
Algorithm Hash digest
SHA256 0063f57a6c7b84c8fd466f0da1314f5889b978009a180d029713f58fc80f4959
MD5 55e9056f3e3ec0a018e10939df70b6c3
BLAKE2b-256 d5d06e579499737b5d17f1778fc4a84f91444ac9dce361b4a2c39212816dd190

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.2.1-py35-none-any.whl
  • Upload date:
  • Size: 100.5 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.8.0

File hashes

Hashes for xdis-4.2.1-py35-none-any.whl
Algorithm Hash digest
SHA256 9f03075f008e2eb8e354a1a9c9e7ca479940645973d0e3d96366c7ee98b57adf
MD5 7f6f409b500cb99870ac3c5f1017cbc6
BLAKE2b-256 7b29082f5aebe974e5def69361174447343ebb99a4edec0336a5433a9af8cc88

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.2.1-py34-none-any.whl
  • Upload date:
  • Size: 100.5 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.8.0

File hashes

Hashes for xdis-4.2.1-py34-none-any.whl
Algorithm Hash digest
SHA256 4d655b87eaedab3b08d3ad4975b3a47e35388c16a0fb65e1d1ea46c18151ede1
MD5 7fcfc5436dc45b5e674aa491871834dc
BLAKE2b-256 17e2f68aabef0e36c2f3da142d6a0bb16f94e0205303cad9bce9d5fa32953e85

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.2.1-py33-none-any.whl
  • Upload date:
  • Size: 96.3 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.8.0

File hashes

Hashes for xdis-4.2.1-py33-none-any.whl
Algorithm Hash digest
SHA256 fba5119e88b55a28be3ff833daba8b8060bea9ecd4d99ec443a4a47b4545838a
MD5 25ac13f6cd00f77c9ae6f932240a44f4
BLAKE2b-256 0c8e11b3180c14d479cbf8b2dbf5bbc2ad5e180709bd02ab03ef568cf1111616

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.2.1-py32-none-any.whl
  • Upload date:
  • Size: 96.3 kB
  • Tags: Python 3.2
  • 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.8.0

File hashes

Hashes for xdis-4.2.1-py32-none-any.whl
Algorithm Hash digest
SHA256 51abc86fdff727f58a4c7b3962d673d53c9b1c8a0eb4247f5129df4d7bc44111
MD5 e74fc2301ab407a697b6e9213d727839
BLAKE2b-256 d9901a7f4d98fcee7afc849f0bfa2ae1a01d482710121bcbd3955e0e9f2be8b7

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.2.1-py27-none-any.whl
  • Upload date:
  • Size: 100.5 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.8.0

File hashes

Hashes for xdis-4.2.1-py27-none-any.whl
Algorithm Hash digest
SHA256 bca75014fc82d236da238eba1d9cd6e1172dbd5737df5c9266fc86e705d6a1c7
MD5 7796d271112c050d17fe3cb405472627
BLAKE2b-256 1a4d4602993f5532d02c08eafccec503c01b608e571301610e52457255630e3c

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.2.1-py26-none-any.whl
  • Upload date:
  • Size: 96.3 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.8.0

File hashes

Hashes for xdis-4.2.1-py26-none-any.whl
Algorithm Hash digest
SHA256 07da4f0e439e5927e9e7c1d1eeeee80a5b1918ca5b7d78b5d547ef792069a8b6
MD5 cfb57e2562b5a49f85c6f9f3f6534fb5
BLAKE2b-256 30f1464681ecb76890d1a531875b32c0c5e69abcec39cacef6ed36c00a2f5845

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.2.1-py3.8.egg
  • Upload date:
  • Size: 186.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.8.0

File hashes

Hashes for xdis-4.2.1-py3.8.egg
Algorithm Hash digest
SHA256 4ba1d95d83a085a2e09bdd4347df9eecf52aee9126ec4e1ed3c62642800522a4
MD5 f4763ebb2f6b526a2c483172fa25ec8d
BLAKE2b-256 577f5904a49020d9772c387d57aee8b896fc1c11a9e2bd89bcfd7783ac52189d

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.2.1-py3.7.egg
  • Upload date:
  • Size: 186.3 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.8.0

File hashes

Hashes for xdis-4.2.1-py3.7.egg
Algorithm Hash digest
SHA256 fd90601f2bf871799aa732b5ffe50ab1f0d8d5546577f94454a504b60cfb0d3d
MD5 af91507cf0ef0290b39d572c133b0598
BLAKE2b-256 7f0333ac55388fb653d73e8c174ae30cd9dd5de225def8cdd075ee7c375d019b

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.2.1-py3.6.egg
  • Upload date:
  • Size: 186.3 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.8.0

File hashes

Hashes for xdis-4.2.1-py3.6.egg
Algorithm Hash digest
SHA256 c995178989e9dd6b8643e30f8641b9ae74387cb75388747f7af04ef3b1eea42c
MD5 606c868f485e0a6e4ca3599a9f755e8d
BLAKE2b-256 dee9f58deeaec4c18f521bfbb3a9ca90ba51ae172fefeb4da7667048fb4946a9

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.2.1-py3.5.egg
  • Upload date:
  • Size: 189.4 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.8.0

File hashes

Hashes for xdis-4.2.1-py3.5.egg
Algorithm Hash digest
SHA256 a29c6cf652edb5588936a1a2c6479197b328eabcbeda0ffb2165f8accd7d72dd
MD5 831b4c9429715de33803b94a3f2b4610
BLAKE2b-256 a6b4472b5a0beb4e379b5e581b12f91bce745c876419c073f4dd5007e9b039db

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.2.1-py3.4.egg
  • Upload date:
  • Size: 189.9 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.8.0

File hashes

Hashes for xdis-4.2.1-py3.4.egg
Algorithm Hash digest
SHA256 16669d87b82e7f72fd253d4dedc70ac8637d5ca97c8bed666012ffbe1fb9bfcb
MD5 8aa09664c1207b474466301cc6b812df
BLAKE2b-256 49b7759f3f84f38db1395a5e73da5eccc2906cb45cf2eefe0668c5eb89d0b04e

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.2.1-py3.3.egg
  • Upload date:
  • Size: 190.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.8.0

File hashes

Hashes for xdis-4.2.1-py3.3.egg
Algorithm Hash digest
SHA256 7e6d0085292727b43e2aa066ccac07c1a0a1bbc8c002cda1446bd5af7a8b03cf
MD5 829fdc91e57f277a4d987df802767889
BLAKE2b-256 d61c32632fb5091fa15b824f9aa739b404552737b53f3d2ed39ba4b61160d239

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.2.1-py3.2.egg
  • Upload date:
  • Size: 188.3 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.8.0

File hashes

Hashes for xdis-4.2.1-py3.2.egg
Algorithm Hash digest
SHA256 e37121191d637164f9d2d7c951ff4f54b034282b1d2a27dbbadbb28946176782
MD5 67e3242dee932a405772f38eb8c7fb6c
BLAKE2b-256 69cec1105ccc745b65c1314184d3fc9ebdca2ed12b5a5666a4c79aaf1726627b

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.2.1-py2.7.egg
  • Upload date:
  • Size: 186.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.8.0

File hashes

Hashes for xdis-4.2.1-py2.7.egg
Algorithm Hash digest
SHA256 2021d919325e534bee6535a2cbf5e38b715c140697955337466ab53b6381d860
MD5 9c3583b400450e6946e1aa841cdc3399
BLAKE2b-256 69647bb13efba2602c1e306e30dea398dc58cdf7cc9cae16771d6ebaf0b05812

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.2.1-py2.6.egg
  • Upload date:
  • Size: 186.4 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.8.0

File hashes

Hashes for xdis-4.2.1-py2.6.egg
Algorithm Hash digest
SHA256 4d04237895aff598c899dd0958476a7289598526caabb557db7a689e06fb3a58
MD5 917c8b8d269d36a768386904a79bb7e9
BLAKE2b-256 22159aedb8b149e13147824d30aac7fe5060c68c07c5a110a4551554dc5b41a4

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.2.1-py2.5.egg
  • Upload date:
  • Size: 196.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.8.0

File hashes

Hashes for xdis-4.2.1-py2.5.egg
Algorithm Hash digest
SHA256 dd82fd2fd7a2ec7324b7eafea3c9260269f5332b17ea8cd208eb9716fd46a5f8
MD5 3784f4ffb1618f0b9667ca5a46f762ff
BLAKE2b-256 6479d8df9280b2d7e20fa903740ba90211227711d229282e584bbd35bca24520

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: xdis-4.2.1-py2.4.egg
  • Upload date:
  • Size: 199.9 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.8.0

File hashes

Hashes for xdis-4.2.1-py2.4.egg
Algorithm Hash digest
SHA256 de920b6015dab7f94bb94ec81c4bd3807a8fdcbb6557c3a1b193ab2dec53e72c
MD5 f6e50a33a76c4eec38dcfbd1aa743982
BLAKE2b-256 0aea0889f161fa6165e9faec088ff4a933243f5b3a0c60646ccea41ddd7a95c2

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