Skip to main content

Python cross-version byte-code disassembler and marshal routines

Project description

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 the most modern Python 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.10 or so. The code requires Python 2.4 or later and has been tested on Python running lots of Python versions.

When installing, except for the most recent versions of Python, use the Python egg or wheel that matches that version, e.g. xdis-6.0.2-py3.3.egg, xdis-6.0.2-py33-none-any.whl. Of course for versions that pre-date wheel’s, like Python 2.6, you will have to use eggs.

To install older versions for from source in git use the branch python-2.4-to-2.7 for Python versions from 2.4 to 2.7, python-3.1-to-3.2 for Python versions from 3.1 to 3.2, python-3.3-to-3.5 for Python versions from 3.3 to 3.5. The master branch handles Python 3.6 and later.

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

Uploaded Source

Built Distributions

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

xdis-6.0.4-py310-none-any.whl (139.1 kB view details)

Uploaded Python 3.10

xdis-6.0.4-py38-none-any.whl (139.1 kB view details)

Uploaded Python 3.8

xdis-6.0.4-py37-none-any.whl (139.1 kB view details)

Uploaded Python 3.7

xdis-6.0.4-py36-none-any.whl (139.1 kB view details)

Uploaded Python 3.6

xdis-6.0.4-py35-none-any.whl (139.1 kB view details)

Uploaded Python 3.5

xdis-6.0.4-py34-none-any.whl (139.1 kB view details)

Uploaded Python 3.4

xdis-6.0.4-py33-none-any.whl (135.2 kB view details)

Uploaded Python 3.3

xdis-6.0.4-py3.10.egg (269.9 kB view details)

Uploaded Egg

xdis-6.0.4-py3.9.egg (267.2 kB view details)

Uploaded Egg

xdis-6.0.4-py3.8.egg (267.8 kB view details)

Uploaded Egg

xdis-6.0.4-py3.7.egg (269.6 kB view details)

Uploaded Egg

xdis-6.0.4-py3.6.egg (269.7 kB view details)

Uploaded Egg

xdis-6.0.4-py3.5.egg (272.4 kB view details)

Uploaded Egg

xdis-6.0.4-py3.4.egg (273.4 kB view details)

Uploaded Egg

xdis-6.0.4-py3.3.egg (274.7 kB view details)

Uploaded Egg

xdis-6.0.4-py3.2.egg (271.6 kB view details)

Uploaded Egg

xdis-6.0.4-py3.1.egg (268.5 kB view details)

Uploaded Egg

xdis-6.0.4-py2.7.egg (276.7 kB view details)

Uploaded Egg

xdis-6.0.4-py2.6.egg (277.0 kB view details)

Uploaded Egg

xdis-6.0.4-py2.5.egg (274.7 kB view details)

Uploaded Egg

xdis-6.0.4-py2.4.egg (280.0 kB view details)

Uploaded Egg

xdis-6.0.4-py2-none-any.whl (142.7 kB view details)

Uploaded Python 2

File details

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

File metadata

  • Download URL: xdis-6.0.4.tar.gz
  • Upload date:
  • Size: 371.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for xdis-6.0.4.tar.gz
Algorithm Hash digest
SHA256 1bc5453cfa0ea8331f5bdf6ddba53f50b8289ac368d9fddb135cbbdf42aeffb8
MD5 a3172171bc314ed4060e6d23decbf361
BLAKE2b-256 171e27673df4cdc2f0b8c182ccf5927b88d74ab501dc3332fdb48123a9a53131

See more details on using hashes here.

File details

Details for the file xdis-6.0.4-py310-none-any.whl.

File metadata

  • Download URL: xdis-6.0.4-py310-none-any.whl
  • Upload date:
  • Size: 139.1 kB
  • Tags: Python 3.10
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for xdis-6.0.4-py310-none-any.whl
Algorithm Hash digest
SHA256 288ad36acd198dd6c9dfe5d7c3555ff653280558ee752438dccb4cc63285e024
MD5 e0cde9469ce5acb03c50b91730efa470
BLAKE2b-256 a2fec252fb6fb9ed5a874209ce2bdcd69cd1d27f3e163ba335f18f687e176f8f

See more details on using hashes here.

File details

Details for the file xdis-6.0.4-py38-none-any.whl.

File metadata

  • Download URL: xdis-6.0.4-py38-none-any.whl
  • Upload date:
  • Size: 139.1 kB
  • Tags: Python 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for xdis-6.0.4-py38-none-any.whl
Algorithm Hash digest
SHA256 18f91849ced2b0786bf196e65520e42384ce71cc6980caa55f12c2b0fbd73115
MD5 8dd9533f34d3ae8f969cc3eb10acab32
BLAKE2b-256 4709f40b0806c7064045499c7bc09828e74c8c20554703d2cb575b086ddc8e4b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-6.0.4-py37-none-any.whl
  • Upload date:
  • Size: 139.1 kB
  • Tags: Python 3.7
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for xdis-6.0.4-py37-none-any.whl
Algorithm Hash digest
SHA256 6e58aad4a115636f7bcd91e77c4220bd7a135a2770ca3400c394f6db11fb72e7
MD5 f8743ee3311c7cc64ed6b814304429bb
BLAKE2b-256 1d9b9e5683450dfc395d0e7fbcdc8094f6a71500f4b8b0e9981addf4e3b5e85b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-6.0.4-py36-none-any.whl
  • Upload date:
  • Size: 139.1 kB
  • Tags: Python 3.6
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for xdis-6.0.4-py36-none-any.whl
Algorithm Hash digest
SHA256 1fd4eb936c21e1bae641f194601f31801c2b6fcb7d7dfe8eb791d2ca8626b32a
MD5 b0cc8706d9ab51c7b9a5b3500fbd5e0a
BLAKE2b-256 57714da94bcf509201c4b61c34f3f742879c959629b4265b3caffa70eb9e740d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-6.0.4-py35-none-any.whl
  • Upload date:
  • Size: 139.1 kB
  • Tags: Python 3.5
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for xdis-6.0.4-py35-none-any.whl
Algorithm Hash digest
SHA256 6911e4f2f69367846e6ae9ea3a13c130590d760b0cc5680bd4ccbdfa5a52f324
MD5 008b73048ddef24bf7b70a261efdf8ca
BLAKE2b-256 51221faae0893b85fc1d2480d082e458518a21c116b6505d03682a5c57a6d142

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-6.0.4-py34-none-any.whl
  • Upload date:
  • Size: 139.1 kB
  • Tags: Python 3.4
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for xdis-6.0.4-py34-none-any.whl
Algorithm Hash digest
SHA256 d85694b944b2abb389ce6483995bb43accbf1fce34fcc88a29767886097b29d2
MD5 293fc3373fde1b5988f4eaf57b714b52
BLAKE2b-256 39cc1af29e18cd7066aae57e1e8e14caf7625c67b99e69098526edabb5b754f3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-6.0.4-py33-none-any.whl
  • Upload date:
  • Size: 135.2 kB
  • Tags: Python 3.3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for xdis-6.0.4-py33-none-any.whl
Algorithm Hash digest
SHA256 c8d43a7d323dcfaf74ae41d9030ed21c64e8d9df367fb489304e1db6e65cfd95
MD5 22e8f621ffb14f663050948bb73b1014
BLAKE2b-256 b7d7b17e0805a5c3aa7880f1a8ae9e4619a9534416f63af2b6d294b24365d524

See more details on using hashes here.

File details

Details for the file xdis-6.0.4-py3.10.egg.

File metadata

  • Download URL: xdis-6.0.4-py3.10.egg
  • Upload date:
  • Size: 269.9 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for xdis-6.0.4-py3.10.egg
Algorithm Hash digest
SHA256 2944647d3d81369a8d78a2a9ab4984ce95a3e74617087b452eb2b9e081bddff4
MD5 0bd8d3bd3c6971dc9636eec429773f79
BLAKE2b-256 3d93ca7ffec3b3e240c6254dc1d6ae941d9fbe7a8b3d0dab9ce9575af70b16cf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-6.0.4-py3.9.egg
  • Upload date:
  • Size: 267.2 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for xdis-6.0.4-py3.9.egg
Algorithm Hash digest
SHA256 dfdc53aaeda620e04ca6fc83a86963e30f8cbd5559c7c51b103d1882b551151a
MD5 24a60ab8463a59a1479f025320515a04
BLAKE2b-256 badbee80ffdca58a3682336e46e01348b0f881c59e1b7383eead2fcf4ac37a27

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-6.0.4-py3.8.egg
  • Upload date:
  • Size: 267.8 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for xdis-6.0.4-py3.8.egg
Algorithm Hash digest
SHA256 e960b7e22fa789cb43e8f0a0f887d585d3a66786f0bb559dd1a984e35ee01321
MD5 95c33085b80f56743d91d3033fd589d1
BLAKE2b-256 89665801be0abc4d239fd4ae0459f3bf04e635d0c862a3b547e6d9f0b363fb08

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-6.0.4-py3.7.egg
  • Upload date:
  • Size: 269.6 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for xdis-6.0.4-py3.7.egg
Algorithm Hash digest
SHA256 519c22b4e70de733d631ac0ac37e422c41f270e4d99b2c55df3daf763e4fcfcc
MD5 87d4c69433e97839355183dda3b1cc08
BLAKE2b-256 a52d66cd4b67b15d5f8436fb58d5fb94114f4961e8d463b0c9d83cd30128837d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-6.0.4-py3.6.egg
  • Upload date:
  • Size: 269.7 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for xdis-6.0.4-py3.6.egg
Algorithm Hash digest
SHA256 33c7bce40496a791cdfe829f14e33631e05618616d91bcedce82eccc546f8819
MD5 f5c55fc86d7a7521111f632ede62ef2d
BLAKE2b-256 60f11b03b370c121513ffcb029cb9a7753dcf36cd1468f2582f12294389bc5cf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-6.0.4-py3.5.egg
  • Upload date:
  • Size: 272.4 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for xdis-6.0.4-py3.5.egg
Algorithm Hash digest
SHA256 cdce2707fb0ea7fe108eddcb2af51898997bc1ab051751b16fd8f6b0b30b3925
MD5 bb5f552eef111baf7be7fdec4613f777
BLAKE2b-256 b9ae6c8d6fbf7063e33e3676dbb5ff1826e1141bf4024c8764f3cea2a5ea1e24

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-6.0.4-py3.4.egg
  • Upload date:
  • Size: 273.4 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for xdis-6.0.4-py3.4.egg
Algorithm Hash digest
SHA256 2bf73b8b5b481eb3c176da9044ed450f6db9a74b1ddfc4db8ddb64e08c830b09
MD5 a9895e7e8050f42d3a50ba0837acdefa
BLAKE2b-256 c8d121677dcb1718ca1d5c6a6bf5fa2a23e3081612a90cfe3bbed6a8d69576d3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-6.0.4-py3.3.egg
  • Upload date:
  • Size: 274.7 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for xdis-6.0.4-py3.3.egg
Algorithm Hash digest
SHA256 002b20895fb383d462b26a4c8a822ac40a4aba831bad974fd0882a8a76f24aef
MD5 b6b9141e4c33794646fb006ca61c8a1b
BLAKE2b-256 33c2002c8451991117c58bd90f671892712cbf6d57ecbe931242624ead08854d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-6.0.4-py3.2.egg
  • Upload date:
  • Size: 271.6 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for xdis-6.0.4-py3.2.egg
Algorithm Hash digest
SHA256 ae46452e2b9c4ca6d41c6ee824c44880e3b84ba0930e0f6a73abbcbeb534730f
MD5 498852de5a68437c5b01a6571007d745
BLAKE2b-256 cc07949523b8a1d9a1465fb46031c9bb6500e4c4ca2b7b35e0bcc57b65e582b2

See more details on using hashes here.

File details

Details for the file xdis-6.0.4-py3.1.egg.

File metadata

  • Download URL: xdis-6.0.4-py3.1.egg
  • Upload date:
  • Size: 268.5 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for xdis-6.0.4-py3.1.egg
Algorithm Hash digest
SHA256 ed1561adf6671a6ec13ae35c41e76bfad564eae486597d2e2ea0340850eaed90
MD5 9d831f2462bb0cc56a9849cd959214f5
BLAKE2b-256 3a4d6f44f4d43201dce1fc3ac7ed1614617389fdca0ace1ae575e0e5723acf39

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-6.0.4-py2.7.egg
  • Upload date:
  • Size: 276.7 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for xdis-6.0.4-py2.7.egg
Algorithm Hash digest
SHA256 326de2982243c411edd8b9064ce0a5da9ce18cfb215d4b495042bbcd8e47d285
MD5 4de1594f0e6297a40df4b4b98442bb09
BLAKE2b-256 a85a28bb7a163a9ff04c90d71dca94403e25b9116a5aed075a1442f81a93581e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-6.0.4-py2.6.egg
  • Upload date:
  • Size: 277.0 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for xdis-6.0.4-py2.6.egg
Algorithm Hash digest
SHA256 e71216b9bed8fe2288d9315499e993f36af80c081ec09b116bd712257c506f65
MD5 df55b488e9a4339c7096c9202872ea7a
BLAKE2b-256 85387077d209526918608475e3f85f68fbd40f29fd7d5dfd809032e11e6f6c86

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-6.0.4-py2.5.egg
  • Upload date:
  • Size: 274.7 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for xdis-6.0.4-py2.5.egg
Algorithm Hash digest
SHA256 74f16078398d79367f8918e724f323e97f57238bd210b7f19de150814b1e6414
MD5 3526aa9eff019cc288e92df28bceb91f
BLAKE2b-256 201081e202c8ace98779a8839825897a93d4387173279c5ae1a8c2f227ca5d70

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-6.0.4-py2.4.egg
  • Upload date:
  • Size: 280.0 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for xdis-6.0.4-py2.4.egg
Algorithm Hash digest
SHA256 0d9d2c636909c70f903d1ef933e1bea1b46176020ab6d5a62e97ef50a7637c19
MD5 0e29bed2d8241970b5030a8ca676e115
BLAKE2b-256 cc7f93abce644ddac9c460ea5700bac158d8cb2e412bbeec6a2ef695394b4d20

See more details on using hashes here.

File details

Details for the file xdis-6.0.4-py2-none-any.whl.

File metadata

  • Download URL: xdis-6.0.4-py2-none-any.whl
  • Upload date:
  • Size: 142.7 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for xdis-6.0.4-py2-none-any.whl
Algorithm Hash digest
SHA256 e94f10448fbbde1ab4aea753275def610e599c02eb3b2ffd3e9bee87f93cef8a
MD5 543a7f499afed43a76d8d87842a612d9
BLAKE2b-256 c1c5be76b1e0dc95fe9b375710e2cb67d95ecde0297ca09f1b1900674f41c02e

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