GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - zpoint/CPython-Internals: Dive into CPython internals, trying to illustrate every detail of CPython implementation

BranchesTags
Open more actions menu

Latest commit

 

History

415 Commits
415 Commits

Folders and files

NameName
Last commit message
Last commit date
BasicObject
BasicObject
 
 
Extension
Extension
 
 
Interpreter
Interpreter
 
 
Media
Media
 
 
Modules
Modules
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
README_CN.md
README_CN.md
 
 
README_KR.md
README_KR.md
 
 
_config.yml
_config.yml
 
 
change_code_reference.py
change_code_reference.py
 
 

Repository files navigation

Cpython Internals

cpython logo

  • 简体中文
  • 한국어
  • Watch this repo if you need to be notified when there's an update

This repository contains my notes/blog for cpython source code

It attempts to illustrate every detail of CPython implementation

# 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
  • Modules
  • Lib
  • Interpreter
  • Extension
  • Learning material
  • Contribution
  • License

Objects

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

Modules

  • io
    • fileio
  • pickle

Lib

  • re(regex)
  • asyncio

Interpreter

  • gil(Global Interpreter Lock)
  • gc(Garbage Collection)
  • memory management
  • descr(how does attribute access work/__get__/__getattribute__/__getattr__)
  • exception(exception handling)
  • module(how does import work)
  • frame
  • code
  • slots/__slots__(how does attribute initialized in the creation of class/instance)
  • thread
  • PyObject(overview)

Extension

  • C API(profile python code and write pure C extension)
  • Cython(C extension)
  • Boost C++ libaries (C++ extension)
  • C++ extension
    • integrate with NumPy
    • bypass the GIL

Grammar

  • Compile Phase
    • Grammar/MetaGrammar to DFA
    • CST to AST
    • AST to python byte code

Learning material

I only recommend materials I've read

  • CPython internals - Interpreter and source code overview(youtube video)
  • < < Inside The Python Virtual Machine > >
  • < < Python源码剖析 > >
  • rushter(blog/eng)
  • YET ANOTHER PYTHON INTERNALS BLOG(blog/eng)
  • Junnplus(blog/cn)
  • manjusaka(blog/cn)
  • aoik-Python's compiler series(blog/eng)

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

About

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

Topics

ccpythoncpython-internalsinterpreterlearning-materialpythonpython3

Resources

Readme
Activity

Stars

5.1k stars

Watchers

336 watching

Forks

476 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.