Skip to main content

Python module to generate and modify bytecode

Project description

Latest release on the Python Cheeseshop (PyPI) Continuous integration Documentation building Code coverage of bytecode on codecov.io Code formatted using Black

bytecode is a Python module to generate and modify bytecode.

Install bytecode: python3 -m pip install bytecode. It requires Python 3.8 or newer. The latest release that supports Python 3.7 and 3.6 is 0.13.0. The latest release that supports Python 3.5 is 0.12.0. For Python 2.7 support, have a look at`dead-bytecode <https://github.com/p403n1x87/dead-bytecode>`_ instead.

Example executing print('Hello World!'):

from bytecode import Instr, Bytecode

bytecode = Bytecode([Instr("LOAD_NAME", 'print'),
                     Instr("LOAD_CONST", 'Hello World!'),
                     Instr("CALL_FUNCTION", 1),
                     Instr("POP_TOP"),
                     Instr("LOAD_CONST", None),
                     Instr("RETURN_VALUE")])
code = bytecode.to_code()
exec(code)

Project details


Download files

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

Source Distribution

bytecode-0.14.0.tar.gz (94.1 kB view details)

Uploaded Source

Built Distribution

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

bytecode-0.14.0-py3-none-any.whl (37.6 kB view details)

Uploaded Python 3

File details

Details for the file bytecode-0.14.0.tar.gz.

File metadata

  • Download URL: bytecode-0.14.0.tar.gz
  • Upload date:
  • Size: 94.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for bytecode-0.14.0.tar.gz
Algorithm Hash digest
SHA256 d41ad53c657ba0bef1cb4828d9d6e450766e31cb66c6f91fc1851f052889d1b7
MD5 417508ebb93f535ab3af2575f3cfc405
BLAKE2b-256 bbb83b3410303719e5661420f0ec726845b6442a56e85caa7ace588d84a681a2

See more details on using hashes here.

File details

Details for the file bytecode-0.14.0-py3-none-any.whl.

File metadata

  • Download URL: bytecode-0.14.0-py3-none-any.whl
  • Upload date:
  • Size: 37.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for bytecode-0.14.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f7b7cbed3239acee036d6c0f9d04286b100921114601bf844ae569b95bf91a9f
MD5 4dd98b04e6726601fe06d508b1c3cca9
BLAKE2b-256 08c6ed08b13e47597166bc6402072a72d3683bd1fd9e2da8fab59a982377d154

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