Contribute Media
A thank you to everyone who makes this possible: Read More

Hack The CPython

Description

Have you ever realized how dynamic CPython interpreter is? Maybe it is the most dynamic interpreter you may see. It gives interfaces to internal things like garbage collector or AST, allows to alter functions code, modify built-in functions etc.

This talk will go beyond that dynamism. From adding a new syntax to hooking the evaluation loop, it will show how to hack parts of python.

Before understanding these hacks, you will learn internals of CPython step-by- step. Steps are important because in every step we have at least one hacking option. Also it gives the audience a short brief of how python works.

After learning how cpython works, we'll cover how to hack (use things that is not their main purpose) the interpreter and the interfaces it gave. For an example we will disassembly the bytecode and then assemble it again with adding our statements or adding a new syntax for python at runtime with AST.

Talk will hack these steps:
- AST
- Bytecode
- CTypes
- CPython evaluation loop

Details

Improve this page