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

Uploaded Source

Built Distribution

bytecode-0.14.2-py3-none-any.whl (38.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bytecode-0.14.2.tar.gz
  • Upload date:
  • Size: 94.8 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.2.tar.gz
Algorithm Hash digest
SHA256 386378d9025d68ddb144870ae74330a492717b11b8c9164c4034e88add808f0c
MD5 de4227accb10f27a9fc1568cc7f2b0ac
BLAKE2b-256 2266dc5dfb107039d60bd9e0afde0076d582132ffdb8aaea3216b730368b04c1

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: bytecode-0.14.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e368a2b9bbd7c986133c951250db94fb32f774cfc49752a9db9073bcf9899762
MD5 9688c8e72c92f1491b0425c44ee8c617
BLAKE2b-256 f1a0daba101709726e967d791d8104db2efae9e3591b2bc7812104f024c96838

See more details on using hashes here.

Provenance

Supported by

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