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)
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-bytecode instead.
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
Release history Release notifications | RSS feed
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.16.0.tar.gz
(102.1 kB
view details)
Built Distribution
bytecode-0.16.0-py3-none-any.whl
(41.6 kB
view details)
File details
Details for the file bytecode-0.16.0.tar.gz
.
File metadata
- Download URL: bytecode-0.16.0.tar.gz
- Upload date:
- Size: 102.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06676a3c3bccc9d3dc73ee625650ea57df2bc117358826f4f290f0e1faa42292 |
|
MD5 | 7fa490a509a864f93d60662ad963eef4 |
|
BLAKE2b-256 | 97a9a9148f6155206d52a5be8a42e25db7aa88df7d8fe2212685f5dcd4fc256d |
File details
Details for the file bytecode-0.16.0-py3-none-any.whl
.
File metadata
- Download URL: bytecode-0.16.0-py3-none-any.whl
- Upload date:
- Size: 41.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76080b7c0eb9e7e17f961d61fd06e933aa47f3b753770a3249537439d8203a25 |
|
MD5 | 4356ac1f1c44d12bf6965e6ce9e7359b |
|
BLAKE2b-256 | 6058644f89db71b41598ccfd4662a60533790699d0294241d1903207e5a993af |