bytecode (original) (raw)
Python module to generate and modify bytecode
Project description
bytecode is a Python module to generate and modify bytecode.
- bytecode project homepage at GitHub (code, bugs)
- bytecode documentation
- Download latest bytecode release at the Python Cheeseshop (PyPI)
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-bytecodeinstead.
Example executing print('Hello World!'):
from bytecode import Instr, Bytecode
bytecode = Bytecode([Instr("LOAD_GLOBAL", (True, 'print')),
Instr("LOAD_CONST", 'Hello World!'),
Instr("CALL", 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
Built Distribution
File details
Details for the file bytecode-0.16.2.tar.gz
.
File metadata
- Download URL: bytecode-0.16.2.tar.gz
- Upload date: Apr 14, 2025
- Size: 103.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Hashes for bytecode-0.16.2.tar.gz | Algorithm | Hash digest | | | ----------- | ---------------------------------------------------------------- | | | SHA256 | f05020b6dc1f48cdadd946f7c3a03131ba0f312bd103767c5d75559de5c308f8 | | | MD5 | 5eb9e930960c07ceac961e3ceb9d186f | | | BLAKE2b-256 | 53bb51d95655573fefef01943b911875ddc94a2ff0a82167c4a831c11d248150 | |
See more details on using hashes here.
File details
Details for the file bytecode-0.16.2-py3-none-any.whl
.
File metadata
- Download URL: bytecode-0.16.2-py3-none-any.whl
- Upload date: Apr 14, 2025
- Size: 42.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Hashes for bytecode-0.16.2-py3-none-any.whl | Algorithm | Hash digest | | | ----------- | ---------------------------------------------------------------- | | | SHA256 | 0a7dea0387ec5cae5ec77578690c5ca7470c8a202c50ce64a426d86380cddd7f | | | MD5 | 625b0aa4e4a56f9f44f1856cc24ad9f0 | | | BLAKE2b-256 | a7982e09512abee834dc98afa3c167c04b042f2dd29846f5832da3fbe2907660 | |