52 captures
21 Nov 2017 - 21 Aug 2025
Sep OCT Nov
28
2019 2020 2021
success
fail

About this capture

COLLECTED BY

Collection: Common Crawl

Web crawl data from Common Crawl.
TIMESTAMPS

The Wayback Machine - http://web.archive.org/web/20201028204536/https://devguide.python.org/exploring/
 

Navigation



index

next |

previous |


Python »
  Python Developer's Guide »  
|  







23. Exploring CPythons Internals


This is a quick guide for people who are interested in learning more about CPythons internals. It provides a summary of the source code structure and contains references to resources providing a more in-depth view.

23.1. CPython Source Code Layout


This guide gives an overview of CPythons code structure. It serves as a summary of file locations for modules and builtins.

For Python modules, the typical layout is:


Lib/<module>.py

Modules/_<module>.c (if theres also a C accelerator module)

Lib/test/test_<module>.py

Doc/library/<module>.rst


For extension-only modules, the typical layout is:


Modules/<module>module.c

Lib/test/test_<module>.py

Doc/library/<module>.rst


For builtin types, the typical layout is:


Objects/<builtin>object.c

Lib/test/test_<builtin>.py

Doc/library/stdtypes.rst


For builtin functions, the typical layout is:


Python/bltinmodule.c

Lib/test/test_builtin.py

Doc/library/functions.rst


Some exceptions:


builtin type int is at Objects/longobject.c

builtin type str is at Objects/unicodeobject.c

builtin module sys is at Python/sysmodule.c

builtin module marshal is at Python/marshal.c

Windows-only module winreg is at PC/winreg.c



23.2. Additional References


For over 20 years the CPython code base has been changing and evolving. Heres a sample of resources about the architecture of CPython aimed at building your understanding of both the 2.x and 3.x versions of CPython:
Current references
Title Brief Author Version
A guide from parser to objects, observed using GDB Code walk from Parser, AST, Sym Table and Objects Louie Lu 3.7.a0
Green Tree Snakes The missing Python AST docs Thomas Kluyver 3.6
Yet another guided tour of CPython A guide for how CPython REPL works Guido van Rossum 3.5
Python Asynchronous I/O Walkthrough How CPython async I/O, generator and coroutine works Philip Guo 3.5
Coding Patterns for Python Extensions Reliable patterns of coding Python Extensions in C Paul Ross 3.4
Your Guide to the CPython Source Code Your Guide to the CPython Source Code Anthony Shaw 3.8
Historical references
Title Brief Author Version
Python’s Innards Series ceval, objects, pystate and miscellaneous topics Yaniv Aknin 3.1
Eli Bendersky’s Python Internals Objects, Symbol tables and miscellaneous topics Eli Bendersky 3.x
A guide from parser to objects, observed using Eclipse Code walk from Parser, AST, Sym Table and Objects Prashanth Raghu 2.7.12
CPython internals: A ten-hour codewalk through the Python interpreter source code Code walk from source code to generators Philip Guo 2.7.8


 




Table of Contents



23. Exploring CPythons Internals

23.1. CPython Source Code Layout

23.2. Additional References



Sections



1. Getting Started

2. Where to Get Help

3. Lifecycle of a Pull Request

4. Running & Writing Tests

5. Increase Test Coverage

6. Helping with Documentation

7. Documenting Python

8. Silence Warnings From the Test Suite

9. Fixing easy Issues (and Beyond)

10. Issue Tracking

11. Triaging an Issue

12. Following Pythons Development

13. Porting Python to a new platform

14. How to Become a Core Developer

15. Developer Log

16. Accepting Pull Requests

17. Development Cycle

18. Continuous Integration

19. Adding to the Stdlib

20. Changing the Python Language

21. Experts Index

22. gdb Support

23. Exploring CPythons Internals

23.1. CPython Source Code Layout

23.2. Additional References



24. Changing CPythons Grammar

25. Design of CPythons Compiler

26. Design of CPythons Garbage Collector

27. Updating standard library extension modules

28. Coverity Scan

29. Dynamic Analysis with Clang

30. Running a buildbot worker

31. Core Developer Motivations and Affiliations

32. Git Bootcamp and Cheat Sheet

33. Appendix: Topics

Previous topic


22. gdb Support

Next topic


24. Changing CPythons Grammar

This Page



Show Source  







Navigation



index

next |

previous |


Python »
  Python Developer's Guide »  
|  



© Copyright 2011-2020, Python Software Foundation.  
The Python Software Foundation is a non-profit corporation. Please donate.
 
Last updated on Oct 26, 2020.  Found a bug?
 Created using Sphinx 1.8.5.