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.1.tar.gz (94.6 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.1-py3-none-any.whl (38.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bytecode-0.14.1.tar.gz
  • Upload date:
  • Size: 94.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for bytecode-0.14.1.tar.gz
Algorithm Hash digest
SHA256 82e99af6b0f9e71ba9c5daba11f370fc93adf97d423e93a22659dfc7895fb6a2
MD5 2c1dfd8c28c9f07776a8c2dca1d41188
BLAKE2b-256 7952de8f9a155e939c5eb55f56ac0b70e38133d8d6e0e1ed5b0ddece2be00cfe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bytecode-0.14.1-py3-none-any.whl
  • Upload date:
  • Size: 38.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for bytecode-0.14.1-py3-none-any.whl
Algorithm Hash digest
SHA256 00a8f87d9e2385d445c9ee630a1860b75b4a93d646c6dfb15e769bec827609cc
MD5 4b2ca8fe942fc64cc74beab54e14b9de
BLAKE2b-256 187153290cb0c087938a6844106a85ffbc0a507e43b44871c465f18ee5157da5

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