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.4.tar.gz (206.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-4.2.4-py38-none-any.whl (101.8 kB view details)

Uploaded Python 3.8

xdis-4.2.4-py37-none-any.whl (101.8 kB view details)

Uploaded Python 3.7

xdis-4.2.4-py35-none-any.whl (101.8 kB view details)

Uploaded Python 3.5

xdis-4.2.4-py34-none-any.whl (101.8 kB view details)

Uploaded Python 3.4

xdis-4.2.4-py33-none-any.whl (97.6 kB view details)

Uploaded Python 3.3

xdis-4.2.4-py32-none-any.whl (97.6 kB view details)

Uploaded Python 3.2

xdis-4.2.4-py27-none-any.whl (101.8 kB view details)

Uploaded Python 2.7

xdis-4.2.4-py26-none-any.whl (97.6 kB view details)

Uploaded Python 2.6

xdis-4.2.4-py3.8.egg (189.6 kB view details)

Uploaded Egg

xdis-4.2.4-py3.7.egg (189.2 kB view details)

Uploaded Egg

xdis-4.2.4-py3.5.egg (192.4 kB view details)

Uploaded Egg

xdis-4.2.4-py3.4.egg (192.9 kB view details)

Uploaded Egg

xdis-4.2.4-py3.3.egg (193.7 kB view details)

Uploaded Egg

xdis-4.2.4-py3.2.egg (191.2 kB view details)

Uploaded Egg

xdis-4.2.4-py2.7.egg (189.0 kB view details)

Uploaded Egg

xdis-4.2.4-py2.6.egg (189.4 kB view details)

Uploaded Egg

xdis-4.2.4-py2.5.egg (199.7 kB view details)

Uploaded Egg

xdis-4.2.4-py2.4.egg (203.0 kB view details)

Uploaded Egg

File details

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

File metadata

  • Download URL: xdis-4.2.4.tar.gz
  • Upload date:
  • Size: 206.7 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.43.0 CPython/3.8.2

File hashes

Hashes for xdis-4.2.4.tar.gz
Algorithm Hash digest
SHA256 f1a615442b46075152fe3d5f8c5c0ddb1496a5a02405d9618dfe17506a3001eb
MD5 9075f90cbee0ccd775d2c81653c6a35f
BLAKE2b-256 0d4abf830e387fc2b4d65df8706ca6a22d9225fb7b3ddc099ad74aac1edaac5b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.2.4-py38-none-any.whl
  • Upload date:
  • Size: 101.8 kB
  • Tags: Python 3.8
  • 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.43.0 CPython/3.8.2

File hashes

Hashes for xdis-4.2.4-py38-none-any.whl
Algorithm Hash digest
SHA256 97603f88b310312f240ed02c496d14c5399ac57fecab1e47b7952a75e8d7d01d
MD5 397ac4e7b0a2bbc756c153ec3150c911
BLAKE2b-256 0923ea366bb554b1226b559770c7eb99d73196afe216f07bf8e204ac2ecddb4d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.2.4-py37-none-any.whl
  • Upload date:
  • Size: 101.8 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.43.0 CPython/3.8.2

File hashes

Hashes for xdis-4.2.4-py37-none-any.whl
Algorithm Hash digest
SHA256 f330f82f74636513d986268b18d5e0ca669b7b19abb7efe719681e87592d61dc
MD5 b7700f60a63d93ef3274d4efb8db9ecb
BLAKE2b-256 d0ca86318f026ad391fab163059a3a741eac14248bb5b9ac36c7406620880580

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.2.4-py35-none-any.whl
  • Upload date:
  • Size: 101.8 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.43.0 CPython/3.8.2

File hashes

Hashes for xdis-4.2.4-py35-none-any.whl
Algorithm Hash digest
SHA256 f9ec15f5851366578ca5d6f178cd2a12beab7d881e505312473f6efb618757ff
MD5 3a62d84fe9aee361553db29d39430106
BLAKE2b-256 43cf32571e4c1d2e8f2c38dcd09042eb8ae71c73b93a877a4cb0587201313cac

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.2.4-py34-none-any.whl
  • Upload date:
  • Size: 101.8 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.43.0 CPython/3.8.2

File hashes

Hashes for xdis-4.2.4-py34-none-any.whl
Algorithm Hash digest
SHA256 facc930c58f9ddd8109523c34e622042615f8f2eac8802dc135a26ab1a0e9ebc
MD5 cb7f8e8474ed6fc09d8a9b0b24015f01
BLAKE2b-256 5a4dcc514b9c3a673299c233f3e5447c519b7839dc95b2f9fd8bc7a1e70d0119

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.2.4-py33-none-any.whl
  • Upload date:
  • Size: 97.6 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.43.0 CPython/3.8.2

File hashes

Hashes for xdis-4.2.4-py33-none-any.whl
Algorithm Hash digest
SHA256 4927a81e277c1f957e7cf1b2e2b767e94d211dad70a60a6e53c7142b247028a1
MD5 9abe4b76e839998bb13636e45e27b389
BLAKE2b-256 7eb7041f1c489e5001e442d2e5f611e20117487ead4daa9974b99907d5a0c009

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.2.4-py32-none-any.whl
  • Upload date:
  • Size: 97.6 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.43.0 CPython/3.8.2

File hashes

Hashes for xdis-4.2.4-py32-none-any.whl
Algorithm Hash digest
SHA256 9883a0817cc07781cbd3e46c115394a84bad3d89d4af43d9488b484a972e5771
MD5 53793900564da727ef135adc2af0866b
BLAKE2b-256 08f2e0e50bc7df5905e7bb8554267f9dd1c4187bf9584b8ded07e65d31172d42

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.2.4-py27-none-any.whl
  • Upload date:
  • Size: 101.8 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.43.0 CPython/3.8.2

File hashes

Hashes for xdis-4.2.4-py27-none-any.whl
Algorithm Hash digest
SHA256 2eb1e0045b5bf15d846f71b93cc61f4f953ac1e67e8150ce7ad9ac5e34d1145e
MD5 0bed68ae6ff751a36d50f75752a6fb75
BLAKE2b-256 b9d0c6aa2666a502552cd2a2e5a775ddeee693b910b89b952a78f02f7972c4cb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.2.4-py26-none-any.whl
  • Upload date:
  • Size: 97.6 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.43.0 CPython/3.8.2

File hashes

Hashes for xdis-4.2.4-py26-none-any.whl
Algorithm Hash digest
SHA256 e86b4b8f1d172b4e4f9e91ff34d2672e8b5529df42d18dbf49a56adbd823f466
MD5 ffcf9262539c490abbdc4c89ca4e72dd
BLAKE2b-256 3e9c94920e1a4e44f3ed139a59cb6617caa6ffbfe13b50172b5c4ace2f63c259

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.2.4-py3.8.egg
  • Upload date:
  • Size: 189.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.43.0 CPython/3.8.2

File hashes

Hashes for xdis-4.2.4-py3.8.egg
Algorithm Hash digest
SHA256 33d03ec63bce297e484de83f962c5baef0dcadac4baceb2621afafcdc1a05359
MD5 003559685486c41158f8f9655ada7c8c
BLAKE2b-256 b0e1a125b1e7043fe0f778168a5d16893782dfc72ded1573b4a0ce43efe3885a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.2.4-py3.7.egg
  • Upload date:
  • Size: 189.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.43.0 CPython/3.8.2

File hashes

Hashes for xdis-4.2.4-py3.7.egg
Algorithm Hash digest
SHA256 7ce237b4134b5a14edb22191e09092950f25ac0692a754a8e245f3a0882ddf88
MD5 71bfe3eb6e050e718d0c40803fa84eec
BLAKE2b-256 93244cf3c2b86d5ca3775273dc45d716762f40764da31dfdd88f6aa609eea455

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.2.4-py3.5.egg
  • Upload date:
  • Size: 192.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.43.0 CPython/3.8.2

File hashes

Hashes for xdis-4.2.4-py3.5.egg
Algorithm Hash digest
SHA256 2535c2f2d8005e1750d4c3cbbd87690e6a58cf82120b521a834de133c9cdec60
MD5 18d2a97dd7390b34e68247acb66a7e3e
BLAKE2b-256 3693c0eef4cc4a4cea94ca29ec1eb4a39439a43d79abfc7a9c7ce0fc568327ff

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.2.4-py3.4.egg
  • Upload date:
  • Size: 192.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.43.0 CPython/3.8.2

File hashes

Hashes for xdis-4.2.4-py3.4.egg
Algorithm Hash digest
SHA256 4353edadfdd39900f18576b3c0352cc8521752657c67638804969c3de33517e3
MD5 48d16a90e412b21f6f6dc291e3b0d266
BLAKE2b-256 e663a4c8f3f3b3358a4f50d6867557b0303999cecfcf396a1882af11d0d33929

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.2.4-py3.3.egg
  • Upload date:
  • Size: 193.7 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.43.0 CPython/3.8.2

File hashes

Hashes for xdis-4.2.4-py3.3.egg
Algorithm Hash digest
SHA256 2568ef362dda83b68acde40abc64269d207ea7f825e06ce2c663a583351eca06
MD5 498552f4042f3576dd4d7d45b8b7076b
BLAKE2b-256 26bbfddbff7be4ea9d5de6d1ca827d2eb680981e36dd5da6bf3d8dbdb747db2b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.2.4-py3.2.egg
  • Upload date:
  • Size: 191.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.43.0 CPython/3.8.2

File hashes

Hashes for xdis-4.2.4-py3.2.egg
Algorithm Hash digest
SHA256 72751ceea4f1a42aa8376e9311ffb1fd8d17484e2ea8b0168203a6af2cbba4c6
MD5 baa8bfaeb123292478d0a4183833f467
BLAKE2b-256 88d78ae00f46659ea28727ef0e5ce710b308f370b919c29eb4e49d4625a60d91

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.2.4-py2.7.egg
  • Upload date:
  • Size: 189.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.43.0 CPython/3.8.2

File hashes

Hashes for xdis-4.2.4-py2.7.egg
Algorithm Hash digest
SHA256 370e6544775753596154583a1d35ba16e08a35945748b151ae7530fb409e5d6e
MD5 30e0e59fa13fd77b1d93b3aba64640ee
BLAKE2b-256 39816373f89155f1b43a2f696ae5bc7a966249f8d0f68af1c9f72d62cb8da772

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.2.4-py2.6.egg
  • Upload date:
  • Size: 189.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.43.0 CPython/3.8.2

File hashes

Hashes for xdis-4.2.4-py2.6.egg
Algorithm Hash digest
SHA256 85b294cb70dc3919ad2c5bc179e79ab0fbd7f4a88afc318000c52ce81dfc260e
MD5 e86b6dce52ec67ad6e3867b94878966a
BLAKE2b-256 1ae90c91bb9a3a1a25e2e2b3c62d100fcc2a8ce39373409d470f0b52f8041467

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.2.4-py2.5.egg
  • Upload date:
  • Size: 199.7 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.43.0 CPython/3.8.2

File hashes

Hashes for xdis-4.2.4-py2.5.egg
Algorithm Hash digest
SHA256 fe6d0c4fe5aa2b4f19ddea0a7b5d979ebc7a2725bd7dbe05923b5323fd6c2ae9
MD5 a2117119dae45c41804d4571f0955456
BLAKE2b-256 a543b45b8e56fc8e66f93ba62a8997c58446c53bb7815b8445a7c43e583b71e1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.2.4-py2.4.egg
  • Upload date:
  • Size: 203.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.43.0 CPython/3.8.2

File hashes

Hashes for xdis-4.2.4-py2.4.egg
Algorithm Hash digest
SHA256 616632b26e5c2c3218e049444539731dd8360c6e679f3550b2e8a3aba03ccb44
MD5 6ed7bf55fe81e89b37374e34cce2799e
BLAKE2b-256 7bdbba2a5e010701ba45a73de56ce9b2d3a39a754c466264f7b1c3892ef112a4

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