CPython Survival Kit: basic C concepts to understand Python better
09-08, 09:15–09:50 (Europe/Lisbon), Auditorium

The newest Python versions are including many changes that improve the performance and functionality, but what's going on under the hood? In this talk, you will learn the necessary topics to start discovering how CPython internals work, and how to create a new module based in C or C++.


Everyone is happy with what Python 3.11 and the future 3.12 is bringing to the Python ecosystem, but in case you haven't heard already of the improvements, most of them were made at the core of CPython to affect the interpreter.

It is very probable that many people out there, have ideas that can help Python to be better, but for that, you would need to dive into the CPython code at some point, and possibly perform modifications in C.

A subset of the API is indeed written in Python, but most of the other crucial core components are written in C - and with that, many people might not know C so well.
The main building block of the internals, the PyObject, is a particular C-structure with many details and components that are worth studying, similarly, basic functions Python programmers use intensively like the print function, lists, dictionaries, etc - have C at their core.

The main objective of this talk is to motivate people to start being involved in low-level languages that make Python better, mainly not being afraid into picking up a bit of C knowledge to continue improving the core of CPython, and the many solutions out there that allow you to optimize the code, bindings, and why not, the creation of the 'next' blazing fast and performant module that will improve many peoples lives.

After this talk, you will be able to modify Python's functionality from its core, add new API, create your new C-based Python modules, and more.
Some ideas of C would be good, but not necessary.

Outline:
- Highlights of new things in 3.11 and 3.12
- How Python works internally?
+ CPython introduction and repo overview
+ PyObject description
+ Explain how data types works (lists, sets, ...)
- Super brief introduction to the most important features of C to understand CPython
- Creating a C-based extension for Python
- Modifications to the common python functionality.

Hello! My name is Cristián and I currently work as Sr. R&D Manager at The Qt Company. One of my main responsibilities is the Qt for Python project (PySide/Shiboken), which is the set of official bindings of the Qt Framework to Python. In my day to day, I work with C++, Python and CPython, which are usually the topics of my talks. In my spare time, I like to collaborate with Open Source communities, mainly Python such as Python en Español https://hablemospython.dev, Python Chile https://pythonchile.cl, Python España https://es.python.org, and conferences like PyConUS and Europython, and much more!