Tutorial CPython internals: A ten-hour codewalk through the Python interpreter source code by Philip Guo

Storm Shadow

Staff member
Ida Pro Expert
Elite Cracker
Very nice and detailed video tut by Philip Guo

Here are nine lectures walking through the internals of CPython, the canonical Python interpreter implemented in C. They were from a dynamic programming languages course that I taught in Fall 2014 at the University of Rochester. The format isn't ideal, but I haven't seen this level of detail about CPython presented online, so I wanted to share these videos.

Lecture 1 - Interpreter and source code overview

Lecture 2 - Opcodes and main interpreter loop

This lecture references:
Lecture 3 - Frames, function calls, and scope

  • Include/code.h
  • Include/frameobject.h
  • Objects/frameobject.c
  • Python/ceval.c
Lecture 4 - PyObject: The core Python object

Lecture 5 - Example Python data types

  • Objects/abstract.c
  • Include/stringobject.h
  • Objects/stringobject.c
Lecture 6 - Code objects, function objects, and closures

  • Include/code.h
  • Include/funcobject.h
  • Objects/codeobject.c
  • Objects/funcobject.c
Lecture 7 - Iterators

  • Include/iterobject.h
  • Objects/iterobject.c
  • Objects/abstract.c
  • Python/ceval.c
Lecture 8 - User-defined classes and objects

  • Include/classobject.h
  • Objects/classobject.c
  • Objects/abstract.c
  • Python/ceval.c
Lecture 9 - Generators

  • Include/genobject.h
  • Objects/genobject.c
  • Python/ceval.c