zpoint
CPython-Internals
C

Dive into CPython internals, trying to illustrate every detail of CPython implementation

Last updated Jul 7, 2026
5.1k
Stars
476
Forks
1
Issues
+2
Stars/day
Attention Score
79
Language breakdown
C 33.9%
C++ 31.1%
Python 25.3%
Shell 9.7%
โ–ธ Files click to expand
README

Cpython Internals

cpython logo

This repository contains my notes/blog for cpython source code

It attempts to illustrate every detail of CPython implementation

script

based on version 3.8.0a0

cd cpython git reset --hard ab54b9a130c88f708077c2ef6c4963b632c132b3

The following content is suitable for those who have Python programming experience and are interested in the internals of the Python interpreter. For those who need beginner or advanced material, please refer to awesome-python-books

Table of Contents

Objects

- [x] dict - [x] long/int - [x] unicode/str - [x] set - [x] list(timsort) - [x] tuple - [x] bytes - [x] bytearray(buffer protocol) - [x] float - [x] func(user-defined method) - [x] method(builtin method) - [x] iter - [x] gen(generator/coroutine/async generator) - [x] class(bound method/classmethod/staticmethod) - [x] complex - [x] enum - [x] type(mro/metaclass/creation of class/instance)

Modules

- [ ] io - [x] fileio - [x] pickle

Lib

- [x] re(regex) - [ ] asyncio

Interpreter

- [x] gil(Global Interpreter Lock) - [x] gc(Garbage Collection) - [x] memory management - [x] descr(how does attribute access work/get/getattribute/getattr) - [x] exception(exception handling) - [x] module(how does import work) - [x] frame - [x] code - [x] slots/slots(how does attribute initialized in the creation of class/instance) - [x] thread - [x] PyObject(overview)

Extension

- [x] C API(profile python code and write pure C extension) - [ ] Cython(C extension) - [x] Boost C++ libaries (C\+\+ extension) - [ ] C++ extension - [x] integrate with NumPy - [x] bypass the GIL

Grammar

- [x] Compile Phase - [x] Grammar/MetaGrammar to DFA - [x] CST to AST - [x] AST to python byte code

Learning material

I only recommend materials I've read

Contribution

All kinds of contributions are welcome

  • submit a pull request
* if you want to share any knowledge you know * post a new article * correct any technical mistakes * correct English grammar * translation * anything else
  • open an issue
* any suggestions * any questions * correct mistakes * anything else

License

ยฉ 2026 GitRepoTrend ยท zpoint/CPython-Internals ยท Updated daily from GitHub