Hack The CPython

Hack The Interpreter At Runtime

Batuhan Taşkaya


See in schedule Download Slides

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:
- Bytecode
- CTypes
- CPython evaluation loop

Type: Talk (30 mins); Python level: Intermediate; Domain level: Intermediate

Batuhan Taşkaya

I'm living in Turkey and i'm a 10th grade high school student at Mersin. I'm interested in python about 6~ years. It was my first programming language and i never stopped learning it, i never shifted to another language.

Last 2 years i'm working on internal stuffs like hacking the CPython interpreter also i'm sharing everything i have as F/OSS.