Skip to content

Commit 8c5d4cd

Browse files
Update internals section index and source code doc (#1192)
* Reduce the toctree levels displayed and add an introductory paragraph to index * Simplify code layout doc and add links to CPython docs * Update internals/exploring.rst Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com> * Update internals/index.rst Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com> --------- Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
1 parent 58e646e commit 8c5d4cd

File tree

2 files changed

+26
-25
lines changed

2 files changed

+26
-25
lines changed

internals/exploring.rst

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,56 @@
11
.. _exploring:
22

3-
========================
4-
Exploring the internals
5-
========================
3+
===================
4+
CPython source code
5+
===================
66

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.
109

1110

12-
CPython source code layout
13-
==========================
11+
Source code layout
12+
==================
1413

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:
1915

2016
* :file:`Lib/{<module>}.py`
2117
* :file:`Modules/_{<module>}.c` (if there's also a C accelerator module)
2218
* :file:`Lib/test/test_{<module>}.py`
2319
* :file:`Doc/library/{<module>}.rst`
2420

25-
For extension-only modules, the typical layout is:
21+
For an :term:`extension module`, the typical layout is:
2622

2723
* :file:`Modules/{<module>}module.c`
2824
* :file:`Lib/test/test_{<module>}.py`
2925
* :file:`Doc/library/{<module>}.rst`
3026

31-
For builtin types, the typical layout is:
27+
For :ref:`bltin-types`, the typical layout is:
3228

3329
* :file:`Objects/{<builtin>}object.c`
3430
* :file:`Lib/test/test_{<builtin>}.py`
3531
* :cpy-file:`Doc/library/stdtypes.rst`
3632

37-
For builtin functions, the typical layout is:
33+
For :ref:`built-in-funcs`, the typical layout is:
3834

3935
* :cpy-file:`Python/bltinmodule.c`
4036
* :cpy-file:`Lib/test/test_builtin.py`
4137
* :cpy-file:`Doc/library/functions.rst`
4238

43-
Some exceptions:
39+
Some exceptions to these layouts are:
4440

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`
4945
* Windows-only module ``winreg`` is at :cpy-file:`PC/winreg.c`
5046

5147

5248
Additional references
5349
=====================
5450

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:
5954

6055
.. csv-table:: **Current references**
6156
:header: "Title", "Brief", "Author", "Version"

internals/index.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@
22
CPython's internals
33
===================
44

5+
This guide describes the basics of CPython's internals.
6+
It explains the layout of CPython's source code.
7+
It also explains how the parser, compiler, and interpreter
8+
work together to run your Python code.
9+
Finally, it covers the garbage collector and how it manages memory.
10+
511
.. toctree::
6-
:maxdepth: 5
12+
:maxdepth: 3
713

814
exploring
915
parser

0 commit comments

Comments
 (0)