Skip to content

About

Python module to modify bytecode

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

358 Commits

Folders and files

Repository files navigation

bytecode

Latest release on the Python Cheeseshop (PyPI) Build status of bytecode on Travis CI 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.5 or newer.

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)

About

Python module to modify bytecode

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages