Explore the intricacies of CPython internals in this 30-minute EuroPython Conference talk. Dive into a unique challenge of modifying the value of "2 + 2" to equal 5 at runtime using only Python and the ctypes module. Gain insights into the Python data model, CPython compilation process, and execution by the virtual stack machine. Learn about object and type representation in memory, reference counting, and the transformation of Python scripts into abstract syntax trees. Discover how to monkeypatch integer addition without requiring C programming knowledge. The talk covers topics such as peephole optimization, memory protection, and provides an opportunity for questions. Suitable for those interested in understanding the inner workings of CPython and exploring unconventional programming techniques.
Monkey-Patching CPython with Ctypes to Conform to Party Doctrine