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

Uploaded Source

Built Distribution

bytecode-0.15.0-py3-none-any.whl (39.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for bytecode-0.15.0.tar.gz
Algorithm Hash digest
SHA256 0908a8348cabf366b5c1865daabcdc0d650cb0cbdeb1750cc90564852f81945c
MD5 6246531a71d8e6f499017d791c44a577
BLAKE2b-256 b5dca913d549de1e1a3ce1b9ea7b43e687f596712e598963a35bd5f7a3fcc25c

See more details on using hashes here.

Provenance

File details

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

File metadata

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

File hashes

Hashes for bytecode-0.15.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a66718dc1d246b4fec52b5850c15592344a56c8bdb28fd243c895ccf00f8371f
MD5 7a1613fd60b534235442d4395a367277
BLAKE2b-256 603353a00c8a78fbb82d1f1bd5e0ccfb7aeba8ee5614edf35bc548c9b26e1e2b

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