Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Hack the CPython

EuroPython Conference via YouTube

Overview

Explore the dynamic nature of CPython and learn advanced hacking techniques in this 17-minute EuroPython Conference talk. Delve into the interpreter's internals step-by-step, from adding new syntax to modifying the evaluation loop. Discover how to manipulate AST, bytecode, CTypes, and the CPython evaluation loop. Gain insights into disassembling and reassembling bytecode, adding custom statements, and implementing runtime syntax modifications. Cover topics such as lexing, parsing, AST manipulation, bytecode generation, and evaluation. Learn practical hacks like modifying tokens, creating custom decode functions, implementing PEPs, and optimizing code execution. Uncover the potential for extending Python's capabilities through advanced interpreter manipulation techniques.

Syllabus

Intro
Lexing - Tokenization
Parsing - Parser
AST (where actual hack begins)
Bytecode Generation
Evaluation
Walrus on Python 3.7
The Strategy For Hacking
Modifiying the Tokens
Modifying The Source
Creating decode function for Encoding
Adding a search function
Implementing Peps (Example PEP313)
Scoping
Runtime
Rusty Return
Transforming AST (2)
Poophole Optimizer
Optimize Function
Optimizers 2 (Example Elem Local Vars)
Catlizor v1-extended
Hooking

Taught by

EuroPython Conference

Reviews

Start your review of Hack the CPython

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.