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

Uploaded Source

Built Distributions

xdis-4.5.1-py37-none-any.whl (115.8 kB view details)

Uploaded Python 3.7

xdis-4.5.1-py36-none-any.whl (115.8 kB view details)

Uploaded Python 3.6

xdis-4.5.1-py35-none-any.whl (115.8 kB view details)

Uploaded Python 3.5

xdis-4.5.1-py34-none-any.whl (115.8 kB view details)

Uploaded Python 3.4

xdis-4.5.1-py33-none-any.whl (111.6 kB view details)

Uploaded Python 3.3

xdis-4.5.1-py32-none-any.whl (111.5 kB view details)

Uploaded Python 3.2

xdis-4.5.1-py26-none-any.whl (111.5 kB view details)

Uploaded Python 2.6

xdis-4.5.1-py3.8.egg (216.3 kB view details)

Uploaded Egg

xdis-4.5.1-py3.7.egg (215.7 kB view details)

Uploaded Egg

xdis-4.5.1-py3.6.egg (215.9 kB view details)

Uploaded Egg

xdis-4.5.1-py3.5.egg (219.5 kB view details)

Uploaded Egg

xdis-4.5.1-py3.4.egg (220.1 kB view details)

Uploaded Egg

xdis-4.5.1-py3.3.egg (221.2 kB view details)

Uploaded Egg

xdis-4.5.1-py3.2.egg (218.5 kB view details)

Uploaded Egg

xdis-4.5.1-py2.6.egg (216.1 kB view details)

Uploaded Egg

xdis-4.5.1-py2.5.egg (225.9 kB view details)

Uploaded Egg

xdis-4.5.1-py2.4.egg (229.7 kB view details)

Uploaded Egg

File details

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

File metadata

  • Download URL: xdis-4.5.1.tar.gz
  • Upload date:
  • Size: 224.4 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.5.1.tar.gz
Algorithm Hash digest
SHA256 2cbdbff1325a78b2f825bc065ccd1d3c827cd5188963ec87a2f89576eb5867bd
MD5 9148e6d4c19a631d4b19b5eecf30968a
BLAKE2b-256 c8991e9d8800e0649bff469f6789a5186af0eb6d5de1582bec59e8838e350516

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.5.1-py37-none-any.whl
  • Upload date:
  • Size: 115.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.5.1-py37-none-any.whl
Algorithm Hash digest
SHA256 ae8f24a0a6045bfea8e6be916ebb3b722d668a5c67315c4cf0d7d71bcf6588a8
MD5 b114fc47926a4030eece7631bf1f993b
BLAKE2b-256 ea0e61c11e4c986615ee2a06902c637bbd53f71392e9320760812d9d60d87b37

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.5.1-py36-none-any.whl
  • Upload date:
  • Size: 115.8 kB
  • Tags: Python 3.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.5.1-py36-none-any.whl
Algorithm Hash digest
SHA256 59a0f6c064c6639d867182a220cd8ddd53797c21d4103103c43b8b5c7df93c0c
MD5 6019e8b9106b11a5150ab62bf3e168ac
BLAKE2b-256 a6b658e369a7db31f685630538aee76ca65359d6ffaf86ac2cf4be8a3d99251a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.5.1-py35-none-any.whl
  • Upload date:
  • Size: 115.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.5.1-py35-none-any.whl
Algorithm Hash digest
SHA256 33da8db6de7defd4620f997d8393676fc20fb4ce2249bbc67595506bb8eb16a6
MD5 0b9ee959aae663f47335662df26317d6
BLAKE2b-256 0dde324c9150ea3840b94c1e8f9622cd2dba93d184e87b8428551cf2d929396c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.5.1-py34-none-any.whl
  • Upload date:
  • Size: 115.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.5.1-py34-none-any.whl
Algorithm Hash digest
SHA256 fd6eb451b042d6089054f891876638614340379d58583e44990856aea6c30cda
MD5 1173acf6a15a294c33e74e86345588df
BLAKE2b-256 68c3555c07a7250334c0d5d9b4e362987ee2165320b551f8b562292eeb922830

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.5.1-py33-none-any.whl
  • Upload date:
  • Size: 111.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.5.1-py33-none-any.whl
Algorithm Hash digest
SHA256 9e208987148c2413b79267e34e3b10bc4c6be2a2579421374f23dfa65385e05d
MD5 6127fcf83972a2989559e123c15d0750
BLAKE2b-256 dc5afad4c6f508bb3c988247cf4a8c9255aa8a68f8166b5b8f57f77d08443823

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.5.1-py32-none-any.whl
  • Upload date:
  • Size: 111.5 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.5.1-py32-none-any.whl
Algorithm Hash digest
SHA256 fd7211eb84f93f91f0611f3fa2425d13ad7aae317434daebbd8d975a86dcc76c
MD5 b1d240979e6cdbc1c6dca6408914f154
BLAKE2b-256 16d3f332c477b65272db75fda54d098cf4aca750c7b1cd0d9acd1635151fce7f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.5.1-py26-none-any.whl
  • Upload date:
  • Size: 111.5 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.5.1-py26-none-any.whl
Algorithm Hash digest
SHA256 a4c8116de0ec24c995a34ca0e5354db8d17541e4e8bb0d3b4511860df558e969
MD5 aefae5ef0218337f9f9eca6ad14d327b
BLAKE2b-256 d82edb268deb8788eaac9282d00f367e95efbd609a94ac4035c9442219b86ac8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.5.1-py3.8.egg
  • Upload date:
  • Size: 216.3 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.5.1-py3.8.egg
Algorithm Hash digest
SHA256 cb27740ad0787be18ab19b99dae8d0abbc2e14b08ec5b6ec98bb133e45c61686
MD5 9f1877e31a3c0023bef13293db62a0df
BLAKE2b-256 c994abe7a74cf33a5fe9e2b335443b11c73ac783d8038d1a9941658e792d141f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.5.1-py3.7.egg
  • Upload date:
  • Size: 215.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.5.1-py3.7.egg
Algorithm Hash digest
SHA256 97ae31f9abe2e614bff0c39e1cc14435c015bd8403041a4bf9cdfea7a72b15b2
MD5 fb5fb8544e316c907d86bfa331f193b1
BLAKE2b-256 455f959409efcac42519d54205eb0bc0f09608c6f49fb5c07a872fff04df058d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.5.1-py3.6.egg
  • Upload date:
  • Size: 215.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.5.1-py3.6.egg
Algorithm Hash digest
SHA256 cf4e00e2a4b492370516641661dd2118035671d12703d4d74c4ec20efc7a365d
MD5 9a8d55ffebb9bb8661f4e784aaace406
BLAKE2b-256 cdf5854536197f3f8dd3301ae3d2491555e3730ff208d84f383a6080dbb2dae1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.5.1-py3.5.egg
  • Upload date:
  • Size: 219.5 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.5.1-py3.5.egg
Algorithm Hash digest
SHA256 80e349afe02aeaf1fd78d04a8620ac6b033d002775f5da805aa0d97214b6f244
MD5 d99b2788524734b4e214be1c3abba5b1
BLAKE2b-256 c36b7103c59d524fd30538ab351785589914d6ce679144715e4628f64e44530a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.5.1-py3.4.egg
  • Upload date:
  • Size: 220.1 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.5.1-py3.4.egg
Algorithm Hash digest
SHA256 73ffd15eadf26173464c607195734d569df7ea5ee0aa4f093bb7fd7b5f2b56bf
MD5 e6e6035f825cc55b8734e04989cfda24
BLAKE2b-256 5c935cacce35a3883732dc577a92f7010aef6265572ecdb8e5d23c00301eae6b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.5.1-py3.3.egg
  • Upload date:
  • Size: 221.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.5.1-py3.3.egg
Algorithm Hash digest
SHA256 3e57e710414957b34c41f14cd2918db826e76f3d2dac93fdcd3d428848bc9fcb
MD5 f345b355f990060bea49e9994cbf590b
BLAKE2b-256 f248e9683c5694243900283b6e8a88143413f3ffbdc0a0db24758f4f6f010ef8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.5.1-py3.2.egg
  • Upload date:
  • Size: 218.5 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.5.1-py3.2.egg
Algorithm Hash digest
SHA256 ab90065a8f6701cb5a26560e1589ea561bb0c63ea346443fcb4deb816a8aacc9
MD5 55647dc70109e70f5d20849c28b41dc2
BLAKE2b-256 db350c6f58e9c11235f3f5db55731e06cf782f4dfcf35a3862528b1143fbc5fb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.5.1-py2.6.egg
  • Upload date:
  • Size: 216.1 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.5.1-py2.6.egg
Algorithm Hash digest
SHA256 ff26d02e7ae007b96af02cb6e0dab53269557e71d67ea69cbcb911c4fc384741
MD5 104bc709504af260ff4e90706b84500d
BLAKE2b-256 ac5916de939b99b3a3a1bb45b9cd776b1fa0e28c30e475fdfe07a112736c8b03

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.5.1-py2.5.egg
  • Upload date:
  • Size: 225.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.5.1-py2.5.egg
Algorithm Hash digest
SHA256 bf7377f36d307298bc440edc1c79300e722a17fbd9bba288f855c7adcc959f70
MD5 6c54cbd322bcd47964a05d328e59c2f8
BLAKE2b-256 c2f386fa686f937235ba6fc946a1232718e107ddfca715597b7997d606b7fd37

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-4.5.1-py2.4.egg
  • Upload date:
  • Size: 229.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.5.1-py2.4.egg
Algorithm Hash digest
SHA256 0e5654d096fd3a3da7f32dc95ff1d7e8dcf1b9e9811e793907fe23c720fb6021
MD5 4f4353d2c661a3f6f297bb02cd8a4af6
BLAKE2b-256 3a74102183f39acbc0474a27789fc5ea10c314f2754b9c6905f12cc5b6223147

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page