|
1 | 1 | .. _exploring: |
2 | 2 |
|
3 | | -======================== |
4 | | -Exploring the internals |
5 | | -======================== |
| 3 | +=================== |
| 4 | +CPython source code |
| 5 | +=================== |
6 | 6 |
|
7 | | -This is a quick guide for people who are interested in learning more about |
8 | | -CPython's internals. It provides a summary of the source code structure |
9 | | -and contains references to resources providing a more in-depth view. |
| 7 | +This section gives an overview of CPython's code structure and provides |
| 8 | +a summary of file locations for modules and built-ins. |
10 | 9 |
|
11 | 10 |
|
12 | | -CPython source code layout |
13 | | -========================== |
| 11 | +Source code layout |
| 12 | +================== |
14 | 13 |
|
15 | | -This guide gives an overview of CPython's code structure. |
16 | | -It serves as a summary of file locations for modules and builtins. |
17 | | - |
18 | | -For Python modules, the typical layout is: |
| 14 | +For a Python :term:`module`, the typical layout is: |
19 | 15 |
|
20 | 16 | * :file:`Lib/{<module>}.py` |
21 | 17 | * :file:`Modules/_{<module>}.c` (if there's also a C accelerator module) |
22 | 18 | * :file:`Lib/test/test_{<module>}.py` |
23 | 19 | * :file:`Doc/library/{<module>}.rst` |
24 | 20 |
|
25 | | -For extension-only modules, the typical layout is: |
| 21 | +For an :term:`extension module`, the typical layout is: |
26 | 22 |
|
27 | 23 | * :file:`Modules/{<module>}module.c` |
28 | 24 | * :file:`Lib/test/test_{<module>}.py` |
29 | 25 | * :file:`Doc/library/{<module>}.rst` |
30 | 26 |
|
31 | | -For builtin types, the typical layout is: |
| 27 | +For :ref:`bltin-types`, the typical layout is: |
32 | 28 |
|
33 | 29 | * :file:`Objects/{<builtin>}object.c` |
34 | 30 | * :file:`Lib/test/test_{<builtin>}.py` |
35 | 31 | * :cpy-file:`Doc/library/stdtypes.rst` |
36 | 32 |
|
37 | | -For builtin functions, the typical layout is: |
| 33 | +For :ref:`built-in-funcs`, the typical layout is: |
38 | 34 |
|
39 | 35 | * :cpy-file:`Python/bltinmodule.c` |
40 | 36 | * :cpy-file:`Lib/test/test_builtin.py` |
41 | 37 | * :cpy-file:`Doc/library/functions.rst` |
42 | 38 |
|
43 | | -Some exceptions: |
| 39 | +Some exceptions to these layouts are: |
44 | 40 |
|
45 | | -* builtin type ``int`` is at :cpy-file:`Objects/longobject.c` |
46 | | -* builtin type ``str`` is at :cpy-file:`Objects/unicodeobject.c` |
47 | | -* builtin module ``sys`` is at :cpy-file:`Python/sysmodule.c` |
48 | | -* builtin module ``marshal`` is at :cpy-file:`Python/marshal.c` |
| 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` |
49 | 45 | * Windows-only module ``winreg`` is at :cpy-file:`PC/winreg.c` |
50 | 46 |
|
51 | 47 |
|
52 | 48 | Additional references |
53 | 49 | ===================== |
54 | 50 |
|
55 | | -For over 20 years the CPython code base has been changing and evolving. |
56 | | -Here's a sample of resources about the architecture of CPython aimed at |
57 | | -building your understanding of both the 2.x and 3.x versions of CPython: |
58 | | - |
| 51 | +The CPython code base is constantly changing and evolving. |
| 52 | +Here's a sample of references about CPython's architecture aimed at |
| 53 | +building your understanding of CPython internals and its evolution: |
59 | 54 |
|
60 | 55 | .. csv-table:: **Current references** |
61 | 56 | :header: "Title", "Brief", "Author", "Version" |
|
0 commit comments