Skip to main content

Python cross-version byte-code disassembler and marshal routines

Project description

buildstatus Supported Python Versions

xdis

Cross-Python bytecode Disassembler and Marshal routines

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.6 disassembly conventions.

Also, if you need to modfiy 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_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.4 to 3.7 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

This uses setup.py, so it follows the standard Python routine:

pip install -r requirements.txt
pip install -r requirements-dev.txt
python setup.py install # may need sudo
# or if you have pyenv:
python setup.py develop

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

This version

3.8.3

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xdis-3.8.3.tar.gz (219.3 kB view details)

Uploaded Source

Built Distributions

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

xdis-3.8.3-py36-none-any.whl (86.1 kB view details)

Uploaded Python 3.6

xdis-3.8.3-py35-none-any.whl (86.1 kB view details)

Uploaded Python 3.5

xdis-3.8.3-py34-none-any.whl (86.1 kB view details)

Uploaded Python 3.4

xdis-3.8.3-py33-none-any.whl (86.1 kB view details)

Uploaded Python 3.3

xdis-3.8.3-py32-none-any.whl (86.1 kB view details)

Uploaded Python 3.2

xdis-3.8.3-py27-none-any.whl (86.1 kB view details)

Uploaded Python 2.7

xdis-3.8.3-py26-none-any.whl (86.1 kB view details)

Uploaded Python 2.6

xdis-3.8.3-py3.6.egg (166.1 kB view details)

Uploaded Egg

xdis-3.8.3-py3.5.egg (168.9 kB view details)

Uploaded Egg

xdis-3.8.3-py3.4.egg (169.3 kB view details)

Uploaded Egg

xdis-3.8.3-py3.3.egg (170.0 kB view details)

Uploaded Egg

xdis-3.8.3-py3.2.egg (167.9 kB view details)

Uploaded Egg

xdis-3.8.3-py2.7.egg (165.9 kB view details)

Uploaded Egg

xdis-3.8.3-py2.6.egg (166.2 kB view details)

Uploaded Egg

xdis-3.8.3-py2.5.egg (176.0 kB view details)

Uploaded Egg

xdis-3.8.3-py2.4.egg (178.8 kB view details)

Uploaded Egg

File details

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

File metadata

  • Download URL: xdis-3.8.3.tar.gz
  • Upload date:
  • Size: 219.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for xdis-3.8.3.tar.gz
Algorithm Hash digest
SHA256 edf8188d12fb1f29246b2f9232bcc0e361ed5ad6845f312178e8060e14ffc78d
MD5 b61cce0e243e173887d7d058127bb8bc
BLAKE2b-256 93a28a7b4d3135a938a075a2f1eaa7b367ab51e306604b6f91179ee0e44c8d0b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xdis-3.8.3-py36-none-any.whl
Algorithm Hash digest
SHA256 41d20df97432fe43ea2309c9eaf64dcf8652ce3a05ee0259dd92463306a0dc46
MD5 9c6f3aa271b556f824de239134460c8b
BLAKE2b-256 f023ad1f8a2c1b60dd77c59e6c3049e0075e03bb030e7e7e2a6fd629ee4cbf8b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xdis-3.8.3-py35-none-any.whl
Algorithm Hash digest
SHA256 217f87690a5439d9b90bc67d27c738eecfa3a57222687decf1d52acb97f91345
MD5 15e8db2cd2d49d3ab57079efb24e6651
BLAKE2b-256 d20bb37dee709cf7878701dc3c8c7ba8059f1259b970e0d9f06a0116eff8aeec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xdis-3.8.3-py34-none-any.whl
Algorithm Hash digest
SHA256 a455a74ee4600185a8b93371eb43097accb6510eeaf65b6c02ac324ea4c0f988
MD5 9cca3cd09a3cbfa766bfe15a3ac54c94
BLAKE2b-256 5053317135745e06984113494b6f7586ead66c97fe57322f9e0dbb088cb110a3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xdis-3.8.3-py33-none-any.whl
Algorithm Hash digest
SHA256 f368450d6c1cf2d19176d3198037eaf7c509127c400508b147b001c898c224e4
MD5 9ca6bb7f013b436b628af7b4502d9245
BLAKE2b-256 c76c239b20a2779f4ef58b6ddecc0611c76d446d45543a04ecf3245e7175724c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xdis-3.8.3-py32-none-any.whl
Algorithm Hash digest
SHA256 668cf45fe0ff2e6ae39a5682e026fa2b6793efac6ba7d663978a3ecd1520d126
MD5 c92bd70aa4df4f466f2c211f8cb99303
BLAKE2b-256 f1a404966a28fcdd5200643c994ef140a7c6d0e0425322355e12f8f62810a5a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xdis-3.8.3-py27-none-any.whl
Algorithm Hash digest
SHA256 d210a8e4c9569b86761fe7724987e0b32f62e5e73971c38647c13e282fbfc909
MD5 0c94865315bbab19db4d5ac31258f7d4
BLAKE2b-256 09ac532112a940af99896c876aa6f031b80cd48dc2dd0576e229e47039486e85

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xdis-3.8.3-py26-none-any.whl
Algorithm Hash digest
SHA256 d17b1427b3f5a62f6426af5b9221a179de37a79c83c8183c436e6716955ae2e8
MD5 5e8d7f22aca7f8c9204cc1a877b372d7
BLAKE2b-256 b56ee74575d136b1f18f7053c7e8902ca4e1788349e8c999f8db2234d7dba2c2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-3.8.3-py3.6.egg
  • Upload date:
  • Size: 166.1 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for xdis-3.8.3-py3.6.egg
Algorithm Hash digest
SHA256 890afadbfb773aab1b2342533cb40fd033ec62efff79ec2ce260a2da74e6fe0b
MD5 3b4b895b6bd9cd4f1a6e94cd7948eabb
BLAKE2b-256 2be535307161a6c91491b49f84e1e8e4bff8347ceceb1c8d6f04b63e3ac16350

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-3.8.3-py3.5.egg
  • Upload date:
  • Size: 168.9 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for xdis-3.8.3-py3.5.egg
Algorithm Hash digest
SHA256 08fdd8e296a30efd1ecb9b871f542cfe68485883b5bdf0912c7b42540371050f
MD5 3102da08af34dc85dbc9ce732fb46b3e
BLAKE2b-256 20e1d9343aa595d3e562f7ca1eb1202c8367c11e564731b4efe91d80023745db

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-3.8.3-py3.4.egg
  • Upload date:
  • Size: 169.3 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for xdis-3.8.3-py3.4.egg
Algorithm Hash digest
SHA256 290593837472c25f542df28dcf378db5b66e3b74c792b52ed90f50d69f562330
MD5 97956058bb1f68f32a1b7b181f67770a
BLAKE2b-256 520005acac63b76c0dbf8187bfe71f12b1f573f4f51b63a09fd7b104e0d4927f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-3.8.3-py3.3.egg
  • Upload date:
  • Size: 170.0 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for xdis-3.8.3-py3.3.egg
Algorithm Hash digest
SHA256 fd697400820808138d657fd8408a0faccd141afed1c2a76b00f36f7fed73f033
MD5 949044d340bfe6b048304f943dc5cbdf
BLAKE2b-256 88c81555c2d1aa36fd2b9fa1dd0f4f324a5b0258624fe8e91dabce5980f22618

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-3.8.3-py3.2.egg
  • Upload date:
  • Size: 167.9 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for xdis-3.8.3-py3.2.egg
Algorithm Hash digest
SHA256 a1b9a5a4e82151629ba7616aa841cb421d2e60a406142c062ea9997b6506c2a9
MD5 e3dca451eab1c857e257a530e4622274
BLAKE2b-256 6cec9a030a6b9e3d2d1174210163a8ff141d763c63f0595f01a6bef96aa7d3e5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-3.8.3-py2.7.egg
  • Upload date:
  • Size: 165.9 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for xdis-3.8.3-py2.7.egg
Algorithm Hash digest
SHA256 61041f46c3f5292dba538f992a3b6367b0d7527742a6fc3d012fda38072e757a
MD5 4afdaedaa95796085553536fe76708f0
BLAKE2b-256 959db2bbb2b1245e8cfa99a0bb1a3857882f1772d8febbaf39f2a06481f18ce2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-3.8.3-py2.6.egg
  • Upload date:
  • Size: 166.2 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for xdis-3.8.3-py2.6.egg
Algorithm Hash digest
SHA256 1bcb6fafeef6dae19f5ba7f2c01df9c9b431aa79236ab03e6da1a7e8f7bf3e4e
MD5 7fe7532472ac21ea5137607fb352538b
BLAKE2b-256 29f06fd719477fc6b5d1041ca9098f0d56e6536d7d8f7e957997f67f32319ce6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-3.8.3-py2.5.egg
  • Upload date:
  • Size: 176.0 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for xdis-3.8.3-py2.5.egg
Algorithm Hash digest
SHA256 440139ca75566c7e8de0deb4ad3f621873f4cae1ebe4f1985cb01c4010a1732d
MD5 359a2376299915001c91a549b47cb09d
BLAKE2b-256 2c5c5fef47472398ae585470f7d16a7383f7fde355e592f8e9d192a4810a28a6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdis-3.8.3-py2.4.egg
  • Upload date:
  • Size: 178.8 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for xdis-3.8.3-py2.4.egg
Algorithm Hash digest
SHA256 4d0ce309691bd7042b1aaa6cc72eecf533bfad606fea9fff2f154c64e2a96c5c
MD5 cbb6974e4b8fe6929e039aa273a3a8a7
BLAKE2b-256 7cef32d81a2cd85410df393a396e1cafff874cdbebe692e223609f893f3c4303

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