跳转到主要内容

Python模块,用于生成和修改字节码

项目描述

Latest release on the Python Cheeseshop (PyPI) Continuous integration Documentation building Code coverage of bytecode on codecov.io Code formatted using Black

bytecode 是一个用于生成和修改字节码的Python模块。

安装bytecode: python3 -m pip install bytecode。它需要Python 3.8或更高版本。支持Python 3.7和3.6的最新版本是0.13.0。支持Python 3.5的最新版本是0.12.0。对于Python 2.7的支持,请查看dead-bytecode

执行示例 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)

项目详细信息


下载文件

下载适用于您的平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源代码分发

bytecode-0.15.1.tar.gz (98.0 kB 查看哈希值)

上传时间 源代码

构建分发

bytecode-0.15.1-py3-none-any.whl (40.0 kB 查看哈希值)

上传时间 Python 3

AWSAWS云计算和安全赞助商DatadogDatadog监控FastlyFastlyCDNGoogleGoogle下载分析MicrosoftMicrosoftPSF赞助商PingdomPingdom监控SentrySentry错误日志StatusPageStatusPage状态页面