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/workcode 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.1.3.tar.gz (203.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.1.3-py37-none-any.whl (99.5 kB view details)

Uploaded Python 3.7

xdis-4.1.3-py36-none-any.whl (99.5 kB view details)

Uploaded Python 3.6

xdis-4.1.3-py35-none-any.whl (99.5 kB view details)

Uploaded Python 3.5

xdis-4.1.3-py34-none-any.whl (99.5 kB view details)

Uploaded Python 3.4

xdis-4.1.3-py33-none-any.whl (95.3 kB view details)

Uploaded Python 3.3

xdis-4.1.3-py32-none-any.whl (95.3 kB view details)

Uploaded Python 3.2

xdis-4.1.3-py27-none-any.whl (99.5 kB view details)

Uploaded Python 2.7

xdis-4.1.3-py26-none-any.whl (95.3 kB view details)

Uploaded Python 2.6

xdis-4.1.3-py3.8.egg (185.0 kB view details)

Uploaded Egg

xdis-4.1.3-py3.7.egg (184.5 kB view details)

Uploaded Egg

xdis-4.1.3-py3.6.egg (184.5 kB view details)

Uploaded Egg

xdis-4.1.3-py3.5.egg (187.6 kB view details)

Uploaded Egg

xdis-4.1.3-py3.4.egg (188.1 kB view details)

Uploaded Egg

xdis-4.1.3-py3.3.egg (188.9 kB view details)

Uploaded Egg

xdis-4.1.3-py3.2.egg (186.5 kB view details)

Uploaded Egg

xdis-4.1.3-py2.7.egg (184.3 kB view details)

Uploaded Egg

xdis-4.1.3-py2.6.egg (184.6 kB view details)

Uploaded Egg

xdis-4.1.3-py2.5.egg (194.8 kB view details)

Uploaded Egg

xdis-4.1.3-py2.4.egg (198.0 kB view details)

Uploaded Egg

File details

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

File metadata

  • Download URL: xdis-4.1.3.tar.gz
  • Upload date:
  • Size: 203.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.1.3.tar.gz
Algorithm Hash digest
SHA256 efdf8e4353e5fa4216619318d4a31076f21c6933ef24dbd1823a2a5f41b1de17
MD5 b5569e9517bbe1feedc315bc8e4cb912
BLAKE2b-256 98ec1bbf1f84b848d83948087082d6d730bf9d340af9dd3bafcb5dd0ccef4695

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.1.3-py37-none-any.whl
  • Upload date:
  • Size: 99.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.1.3-py37-none-any.whl
Algorithm Hash digest
SHA256 3f293e4acfe0bac8ca3a1f9bbf8694ee2db1841f4bdae88b5c1fbf13dda5c293
MD5 5d2d2ba28ba76320a61244da7ac5ffd7
BLAKE2b-256 349deafd0728086444f31a38f982c11b8c84bd51b7afc8807d82f757d8b11712

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.1.3-py36-none-any.whl
  • Upload date:
  • Size: 99.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.1.3-py36-none-any.whl
Algorithm Hash digest
SHA256 8c58374349fb563948b9b87582ad97a77788fda7272745356c6dfa1e35d40259
MD5 2640e9f0165ecbb65b11e10606c148cd
BLAKE2b-256 649c2b6a6b1a55c7c660df5938e9a20f8e8ca495d8b473db0c96cf0eff49a0db

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.1.3-py35-none-any.whl
  • Upload date:
  • Size: 99.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.1.3-py35-none-any.whl
Algorithm Hash digest
SHA256 566dae66f1c658b96d5a7261fb393bcba4c1fa421021d52d389d3691a344d02f
MD5 287a6c84418a4fa1258f7474673b9baf
BLAKE2b-256 a8d157117a18308e06009f31b80651ad18439f62eaf82f20d37666c7c9adc185

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.1.3-py34-none-any.whl
  • Upload date:
  • Size: 99.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.1.3-py34-none-any.whl
Algorithm Hash digest
SHA256 c2d4394b5ba44410c4cc2743aabfc5fae78ddda041c061a8acb0d88652faddb3
MD5 0488cd8ffeb8016e2fba3c07dc04bb0a
BLAKE2b-256 78f06c1842fa000ef359c37b7d405ceb6d034a1e6fb68370aadd4d194b5ae695

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.1.3-py33-none-any.whl
  • Upload date:
  • Size: 95.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.1.3-py33-none-any.whl
Algorithm Hash digest
SHA256 8d14f81c0de216cc22f08f3f3ef5bcb37f05046c50f338407952429beab825f3
MD5 9694388cb6238fb0d6f9afca5a67b3c8
BLAKE2b-256 03068e645989cfea995d424ae1afaa5ee1060092fde62addd66da8c7739afd50

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.1.3-py32-none-any.whl
  • Upload date:
  • Size: 95.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.1.3-py32-none-any.whl
Algorithm Hash digest
SHA256 a88bdc3fac9e84274a0c56d1dd4fde1ec3ed5b97e8c5d4611e636ec528b4f25d
MD5 87b9746268ebf2e686b26671e43989b1
BLAKE2b-256 3acc7ce2dd969b61375dd926883b6af280f1923e022d8540bfaa0f5e9a849c7b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.1.3-py27-none-any.whl
  • Upload date:
  • Size: 99.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.1.3-py27-none-any.whl
Algorithm Hash digest
SHA256 8a9f8e485eeaa7a2aaab05b253be156d6ca7a5ca70cbe7fd55d0ec6ef21d3a7d
MD5 a13b93b3ebfe9ae34c4181a2e795449d
BLAKE2b-256 40bf34a904dd26566d14fb5cfad33730f7ce8bd5cace815a9bf7b79d9a191fb6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.1.3-py26-none-any.whl
  • Upload date:
  • Size: 95.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.1.3-py26-none-any.whl
Algorithm Hash digest
SHA256 e64f8455d4524fc31fb32d4a40fddc87ee32966bd65f947b4f44f03793288550
MD5 80cc15b3e248a36d9fbb3f56e10a1211
BLAKE2b-256 e3506b2cec560dc6ba05019f101592298a65dd68cd384f76e9c7a30c2ff465aa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.1.3-py3.8.egg
  • Upload date:
  • Size: 185.0 kB
  • Tags: Egg
  • 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.1.3-py3.8.egg
Algorithm Hash digest
SHA256 335c2785d7042e02893a880504271839ea870a763a625581a8b1e4823b4a92e9
MD5 6aa218d8c7e513bee5d1e3eed922593a
BLAKE2b-256 f79f59701cc1353e2f9fd33470274c17163dbe1f61bf33cf2d442f59f7638089

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.1.3-py3.7.egg
  • Upload date:
  • Size: 184.5 kB
  • Tags: Egg
  • 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.1.3-py3.7.egg
Algorithm Hash digest
SHA256 0ebf6a85a92f02cdc25985d7018e0337019c53b79f52b457d21323729d94ef04
MD5 39ffa02842d482c61c2236a090a197f2
BLAKE2b-256 5eb5faf9b48860e626a40a026fde83b7dc9179b3a13b0234709099ef9471d7c9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.1.3-py3.6.egg
  • Upload date:
  • Size: 184.5 kB
  • Tags: Egg
  • 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.1.3-py3.6.egg
Algorithm Hash digest
SHA256 a7b39415b7effdd7b54994a66f6cd38b4ff9746bd009ae642f7fe7a10afca938
MD5 0a212034a47554bb0565d310884cec59
BLAKE2b-256 c30877b2cce0b872522b49c95c66639b4f2daae69f8f79bc62df163e080b9c96

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.1.3-py3.5.egg
  • Upload date:
  • Size: 187.6 kB
  • Tags: Egg
  • 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.1.3-py3.5.egg
Algorithm Hash digest
SHA256 6326db2c2fb93f6cab1ccf0596a728cb560819e6c076de9b762dcc3f1ffa8f10
MD5 6bb2c3c6c54c926034d7993c97247d76
BLAKE2b-256 c8d4ac038c0c4ceb23e37db239c855e347b4fc10a2c81a93502f0a8aa360e20c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.1.3-py3.4.egg
  • Upload date:
  • Size: 188.1 kB
  • Tags: Egg
  • 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.1.3-py3.4.egg
Algorithm Hash digest
SHA256 4f454afd95e9d3e181b1ab1c5a57e6ab5742ef690e71b698e36624ee0e0b623f
MD5 5ec66dbc5ee651ae79a0161ef92de455
BLAKE2b-256 d0d63e7967d00cf920d9856c27c55ff83c6fda4bc240cae82e1a8fe2e45594ba

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.1.3-py3.3.egg
  • Upload date:
  • Size: 188.9 kB
  • Tags: Egg
  • 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.1.3-py3.3.egg
Algorithm Hash digest
SHA256 5e59db2a55a1370b52f21e1749fa18c595c774b61799eb2a130806832021e111
MD5 66b75338303731f3f0ae20d31c9c4482
BLAKE2b-256 1f1eccd16aa7154b26956e5ef779ab56ce842212daae688457ea46e4a7062a1f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.1.3-py3.2.egg
  • Upload date:
  • Size: 186.5 kB
  • Tags: Egg
  • 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.1.3-py3.2.egg
Algorithm Hash digest
SHA256 b73d0aab9a9a6afffec0e700fe6645e53179833dec26a7e8a48f55866e8c8597
MD5 6e837c69ba9633bb60a045634efde9c8
BLAKE2b-256 c2e307a8e57a8db583004c011d68e28758f89b36b8b4200d37bb0356b767cdbf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.1.3-py2.7.egg
  • Upload date:
  • Size: 184.3 kB
  • Tags: Egg
  • 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.1.3-py2.7.egg
Algorithm Hash digest
SHA256 2ace728e7480b10a28ce4d35942a832323523c87ee6b95d78ef5d778b82e7cef
MD5 44271fb24a28d50f5988a324464b27e1
BLAKE2b-256 97908f30d3bef6bc593010b019789f65c25931d7479ec65571f16562a84219f0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.1.3-py2.6.egg
  • Upload date:
  • Size: 184.6 kB
  • Tags: Egg
  • 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.1.3-py2.6.egg
Algorithm Hash digest
SHA256 a5f9c04c2a76d5b0f7d68cd808b262253f75e9a11073f6e2f85ee2498d6a9e06
MD5 84b8e95033f3b3b121c26dbf3e5c98b1
BLAKE2b-256 5854a5f86cae7f4390b3ee2baeea9cd1e8b40f039c4a0b8527c9fcc02258706b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.1.3-py2.5.egg
  • Upload date:
  • Size: 194.8 kB
  • Tags: Egg
  • 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.1.3-py2.5.egg
Algorithm Hash digest
SHA256 6f2fbb5c04d091a6254e6c9d59702480985f12e4f9c8a7f8551f2a90f464c28a
MD5 1cc3516fd0269a963f77f3650639edfa
BLAKE2b-256 158d563343eb3c91a1b08431dc29615398e6ae621468c57d40ebd4906f65365b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.1.3-py2.4.egg
  • Upload date:
  • Size: 198.0 kB
  • Tags: Egg
  • 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.1.3-py2.4.egg
Algorithm Hash digest
SHA256 71c0d77a3e976a8b58171b51db75c31fbf8c8bfd648f68c8d29b940efc08265e
MD5 a4afedc0885fb160d33ec016b3e19bc5
BLAKE2b-256 cd539a77fb0dca9259b06b06967f68519093141d873a3669c382c0e7364d50af

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