1- .. _ exploring :
1+ .. _ internals :
22
33===================
4- CPython source code
4+ CPython's internals
55===================
66
7- This section gives an overview of CPython's code structure and provides
8- a summary of file locations for modules and built-ins.
9-
10-
11- Source code layout
12- ==================
13-
14- For a Python :term: `module `, the typical layout is:
15-
16- * :file: `Lib/{ <module> } .py `
17- * :file: `Modules/_{ <module> } .c ` (if there's also a C accelerator module)
18- * :file: `Lib/test/test_{ <module> } .py `
19- * :file: `Doc/library/{ <module> } .rst `
20-
21- For an :term: `extension module `, the typical layout is:
22-
23- * :file: `Modules/{ <module> } module.c `
24- * :file: `Lib/test/test_{ <module> } .py `
25- * :file: `Doc/library/{ <module> } .rst `
26-
27- For :ref: `bltin-types `, the typical layout is:
28-
29- * :file: `Objects/{ <builtin> } object.c `
30- * :file: `Lib/test/test_{ <builtin> } .py `
31- * :cpy-file: `Doc/library/stdtypes.rst `
32-
33- For :ref: `built-in-funcs `, the typical layout is:
34-
35- * :cpy-file: `Python/bltinmodule.c `
36- * :cpy-file: `Lib/test/test_builtin.py `
37- * :cpy-file: `Doc/library/functions.rst `
38-
39- Some exceptions to these layouts are:
40-
41- * built-in type ``int `` is at :cpy-file: `Objects/longobject.c `
42- * built-in type ``str `` is at :cpy-file: `Objects/unicodeobject.c `
43- * built-in module ``sys `` is at :cpy-file: `Python/sysmodule.c `
44- * built-in module ``marshal `` is at :cpy-file: `Python/marshal.c `
45- * Windows-only module ``winreg `` is at :cpy-file: `PC/winreg.c `
46-
47-
48- Additional references
49- =====================
50-
517The CPython code base is constantly changing and evolving.
528Here's a sample of references about CPython's architecture aimed at
539building your understanding of CPython internals and its evolution:
@@ -56,6 +12,7 @@ building your understanding of CPython internals and its evolution:
5612 :header: "Title", "Brief", "Author", "Version"
5713 :widths: 50, 50, 20, 5
5814
15+ "`CPython's InternalDocs `_", "Docs on CPython internals maintained in the source tree", "", ""
5916 "`A guide from parser to objects, observed using GDB `_", "Code walk from Parser, AST, Sym Table and Objects", Louie Lu, 3.7.a0
6017 "`Green Tree Snakes `_", "The missing Python AST docs", Thomas Kluyver, 3.6
6118 "`Yet another guided tour of CPython `_", "A guide for how CPython REPL works", Guido van Rossum, 3.5
@@ -72,6 +29,7 @@ building your understanding of CPython internals and its evolution:
7229 "`A guide from parser to objects, observed using Eclipse `_", "Code walk from Parser, AST, Sym Table and Objects", Prashanth Raghu, 2.7.12
7330 "`CPython internals: A ten-hour codewalk through the Python interpreter source code `_", "Code walk from source code to generators", Philip Guo, 2.7.8
7431
32+ .. _CPython's InternalDocs : https://github.com/python/cpython/blob/main/InternalDocs/README.md
7533
7634.. _A guide from parser to objects, observed using GDB : https://hackmd.io/s/ByMHBMjFe
7735
0 commit comments