Skip to main content
Spotify for Podcasters
core.py

core.py

By Pablo Galindo and Łukasz Langa

It's a-us, foreigners speaking bad English talking about Python internals! One talks like a Mexican, the other like a Russian. Both hate the comparison!
Available on
Apple Podcasts Logo
Google Podcasts Logo
Spotify Logo
Currently playing episode

Episode 4 - Frame Evaluation

core.pyNov 29, 2023

00:00
01:13:21
Episode 4 - Frame Evaluation

Episode 4 - Frame Evaluation

What makes Python an interpreter? Today we're talking about ceval.c, the wonders of frame evaluation, and how it changed over the years.


# Timestamps


(00:00:00) INTRO

(00:00:59) BACK TO PYTHON 2.6

(00:02:53) Stack virtual machine

(00:04:41) First encounter with opcodes

(00:08:06) What even is frame evaluation?

(00:12:51) Stack! Which stack?

(00:15:46) PRESENT DAY

(00:16:41) Computed gotos

(00:21:22) PEP 523: JIT me, maybe

(00:26:53) Let's generate the interpreter

(00:29:08) The JIT is coming

(00:33:13) Python function call inlining

(00:37:23) Instrumentation: DTrace, PEP 669

(00:41:50) lltrace and pystats

(00:44:02) Eval breaker

(00:47:54) Signal handling

(00:50:47) Recursion limits

(00:54:27) String concatenation special case

(00:58:24) WHAT'S GOING ON IN CPYTHON?

(00:58:42) 3.12.0a2

(00:59:12) Critical section API adoption

(00:59:34) PyOnceFlag

(01:00:28) PyDict_GetItemRef()

(01:03:36) PyList_Extend() and PyDict_Pop()

(01:04:18) Parser: better error messages for non-matching elif/else

(01:05:39) glob.translate()

(01:07:22) TLS-PSK in the ssl module

(01:08:35) IDLE debugger improvements

(01:10:50) First micro-op in the Tier 2 interpreter

(01:11:18) OUTRO

Nov 29, 202301:13:21
Episode 3 - Imports, frozen modules, Python news

Episode 3 - Imports, frozen modules, Python news

What happens when you type “import abc”? Why does it say the module is frozen? What significant changes landed in Python in the past two weeks? And why does the “PR of the Week” jingle go so hard? Find out in this week’s episode!


# Timestamps


(00:00:00)  INTRO

(00:01:12)  IMPORTS

(00:02:21)  Here be dragons

(00:02:42)  High level summary

(00:05:12)  Finders and Loaders

(00:06:29)  Loading encrypted modules

(00:08:13)  Debugging by altering someone else's code

(00:10:08)  Support for site-packages

(00:14:22)  Nefarious uses of imports

(00:17:28)  Tagged strings?

(00:21:00)  FROZEN MODULES

(00:23:38)  Deepfreeze origins: importlib

(00:26:01)  Deepfreeze evolution

(00:31:32)  First world problems with build speed

(00:33:05)  WHAT'S GOING ON IN CPYTHON

(00:34:16)  Biased reference counts landed, buildbots

(00:35:51)  There is no nogil, there is only free-threaded

(00:36:54)  mimalloc landed

(00:42:29)  Critical sections landed

(00:45:04)  Tuples can now be shared across subinterpreters

(00:48:31)  JIT beginnings: Tier 2 interpreter merged with Tier 1

(00:50:54)  perf support with DWARF: look ma, no frame pointers

(00:55:05)  Yo DAWG, I herd you liked codepoints

(00:58:46)  Thread.join() waits for the OS thread now

(01:01:04)  PR OF THE WEEK

(01:02:06)  Pablo: gh-109181 -- traceback object creation is now lazy = much faster

(01:05:25)  Łukasz: gh-111710 -- stdlib coverage now gathered with sys.monitoring

(01:10:20)  WRAP UP


Nov 13, 202301:11:45
Episode 2 - PEP 703: Removing the GIL

Episode 2 - PEP 703: Removing the GIL

We've read the PEP on making the Global Interpreter Lock optional so you don't have to.


Timestamps


(00:00:00) Intro

(00:00:50) CURRENT STATE OF THINGS

(00:00:58) Reference counting

(00:01:35) Garbage collection

(00:02:33) What is the Global Interpreter Lock?

(00:03:57) The GIL and threading

(00:07:24) Current ways around the GIL

(00:09:26) HISTORICAL ATTEMPTS TO REMOVE THE GIL

(00:09:46) 1999: Greg Stein's attempt at Python 1.6

(00:10:46) Jython doesn't have the GIL

(00:11:19) 2015: Larry Hastings' Gilectomy at Python 3.5

(00:12:34) Pablo says removing the GIL is actually very easy

(00:13:24) Łukasz is skeptical

(00:14:20) 2021: Sam Gross' nogil at Python 3.9

(00:18:22) 2023: PEP 703 for Python 3.13

(00:20:05) PEP 703 IN DETAIL

(00:20:20) Biased Reference Counting

(00:25:19) Other needed speedups: deferred refcounts, immortalization, GC

(00:28:41) mimalloc

(00:34:46) More GC changes

(00:38:20) eval breaker

(00:42:08) Thread-safe standard collections

(00:45:26) Fast paths vs. slow paths

(00:49:47) Reading freed memory with mimalloc is kinda okay?

(00:58:06) Specializations become harder to implement without the GIL

(01:01:27) PEP 703 terms of acceptance

(01:04:08) No free lunch

(01:09:25) It's now or never

(01:11:59) Outro


Oct 30, 202301:14:40
Episode 1 - Core Sprint in Brno & Python 3.13.0 alpha 1

Episode 1 - Core Sprint in Brno & Python 3.13.0 alpha 1

In this first episode Pablo and Łukasz talk about what happened in at the 2023 Cpython Core Developer sprint. Join us and learn from our ramblings about a possible new CPython new JIT compiler, how we are making the REPL easier, what in the world is a memory hive, and how we are trying to make a new C API without making everyone mad.


Timestamps


(00:00:00) Intro

(00:01:02) Cpython core developer sprint

(00:04:54) Pablo's highlights

(00:06:09) Łukasz's highlights

(00:08:08) Coverage in the standard library

(00:12:20) Improving CPython's REPL

(00:20:38) Copy and patch JIT compiler prototype

(00:28:16) Tier1 and Tier2 interpreter

(00:41:25) Python 3.13.0 alpha 1 and doing CPython releases

(00:52:08) C-API improvements

(00:58:28) Sprint experience and tourism

(01:01:49) Steering council Q&A

(01:08:19) Closing thoughts

Oct 30, 202301:11:60