30249 Commits

Author SHA1 Message Date
Greg Shuflin
ae606bb600 Doc: Add guide for adding extension modules to CPython
Adding a new C extension module to CPython's standard library
requires updating multiple files across different build systems,
which is not well documented. This adds a comprehensive guide that
covers:

- Prerequisites and design decisions (built-in vs shared)
- Step-by-step process for all platforms
- Unix/Linux: configure.ac and Setup file changes
- Windows: MSBuild .vcxproj file creation
- Testing, documentation, and cross-platform considerations
- Troubleshooting common issues with solutions
- Complete pre-submission checklist

The guide is created in a new Doc/build_system/ directory for
build-system-specific documentation that doesn't fit in the
existing extending/ or c-api/ sections.

This significantly reduces the barrier to adding new stdlib modules
and provides a template for contributors to follow.
2025-11-15 00:35:55 -08:00
Greg Shuflin
5019b95705 Doc: Add comprehensive build system architecture documentation
The CPython build system is complex, but lacks comprehensive
documentation explaining how the pieces fit together. This expands
the existing "Python Build System" section in Doc/using/configure.rst
with detailed explanations of:

- Build system overview and key phases
- Platform-specific build system components (autotools, MSBuild, etc.)
- The 4-stage bootstrap process explained step-by-step
- Module configuration system (3-layer architecture)
- Detailed build flow with phase-by-phase breakdown
- Visual build flow diagram

This helps new contributors understand the build system architecture
and reduces questions about "how does CPython build?"

The documentation focuses on conceptual understanding rather than
step-by-step instructions, which are better suited for the devguide.
2025-11-15 00:35:43 -08:00
Steve Dower
b101e9d36b Add PyManager troubleshooting steps for direct launch of script files (GH-141530) 2025-11-14 15:23:01 +00:00
Petr Viktorin
49e74210cb gh-139344: Remove pending removal notice for undeprecated importlib.resources API (GH-141507) 2025-11-14 15:50:03 +01:00
Stan Ulbrych
ef90261be5 gh-141004: Document PyOS_InterruptOccurred (GH-141526) 2025-11-14 06:20:36 -05:00
Itamar Oren
1e4e59bb37 gh-116146: Add C-API to create module from spec and initfunc (GH-139196)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-11-14 10:43:25 +01:00
Osama Abdelkader
a486d452c7 gh-140601: Add ResourceWarning to iterparse when not closed (GH-140603)
When iterparse() opens a file by filename and is not explicitly closed,
emit a ResourceWarning to alert developers of the resource leak.

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-11-13 21:05:28 +02:00
Stan Ulbrych
196f1519cd gh-141004: Document PyErr_RangedSyntaxLocationObject (#141521)
PyErr_RangedSyntaxLocationObject
2025-11-13 17:58:47 +00:00
Serhiy Storchaka
b2b68d40f8 gh-140873: Add support of non-descriptor callables in functools.singledispatchmethod() (GH-140884) 2025-11-13 19:48:52 +02:00
Victor Stinner
b99db92dde gh-139653: Add PyUnstable_ThreadState_SetStackProtection() (#139668)
Add PyUnstable_ThreadState_SetStackProtection() and
PyUnstable_ThreadState_ResetStackProtection() functions
to set the stack base address and stack size of a Python
thread state.

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-11-13 17:30:50 +01:00
Peter Bierma
d7862e9b1b gh-141004: Document PyCode_Optimize (GH-141378) 2025-11-13 10:07:57 -05:00
Peter Bierma
f72768f30e gh-141004: Document C APIs for dictionary keys, values, and items (GH-141009)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-11-13 15:02:21 +00:00
Cody Maloney
732224e113 gh-139871: Add bytearray.take_bytes([n]) to efficiently extract bytes (GH-140128)
Update `bytearray` to contain a `bytes` and provide a zero-copy path to
"extract" the `bytes`. This allows making several code paths more efficient.

This does not move any codepaths to make use of this new API. The documentation
changes include common code patterns which can be made more efficient with
this API.

---

When just changing `bytearray` to contain `bytes` I ran pyperformance on a
`--with-lto --enable-optimizations --with-static-libpython` build and don't see
any major speedups or slowdowns with this; all seems to be in the noise of
my machine (Generally changes under 5% or benchmarks that don't touch
bytes/bytearray).


Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Maurycy Pawłowski-Wieroński <5383+maurycy@users.noreply.github.com>
2025-11-13 13:19:44 +00:00
Serhiy Storchaka
d8e6bdc0d0 gh-135801: Add the module parameter to compile() etc (GH-139652)
Many functions related to compiling or parsing Python code, such as
compile(), ast.parse(), symtable.symtable(),
and importlib.abc.InspectLoader.source_to_code() now allow to pass
the module name used when filtering syntax warnings.
2025-11-13 13:21:32 +02:00
Peter Bierma
26b7df2430 gh-141004: Document PyRun_InteractiveOneObject (GH-141405) 2025-11-12 17:52:56 -05:00
Bob Kline
fbcac79951 gh-141412: Use reliable target URL for urllib example (GH-141428)
The endpoint used for demonstrating reading URLs is no longer
stable. This change substitutes a target over which we have more
control.
2025-11-12 12:25:23 -06:00
Peter Bierma
9cd5427d96 gh-141004: Document PyType_SUPPORTS_WEAKREFS (GH-141408)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-12 11:38:17 -05:00
Stan Ulbrych
f1330b35b8 gh-141004: Document Py_MATH_{E, PI, TAU} constants (#141373) 2025-11-12 17:37:54 +01:00
Stan Ulbrych
88aeff8eab gh-87710: Update mime type for `.ai` (#141239) 2025-11-12 16:22:01 +02:00
Sergey B Kirpichev
e2026731f5 gh-141004: soft-deprecate Py_INFINITY macro (#141033)
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-11-12 13:44:49 +01:00
Jacob Austin Lincoln
70748bdbea gh-131116: Fix inspect.getdoc() to work with cached_property objects (GH-131165) 2025-11-12 10:07:21 +00:00
Sergey B Kirpichev
20f53df07d gh-141370: document undefined behavior of Py_ABS() (GH-141439) 2025-11-12 11:50:44 +02:00
Mark Byrne
35908265b0 gh-75593: Add support of bytes and path-like paths in wave.open() (GH-140951) 2025-11-12 10:20:55 +02:00
Maurycy Pawłowski-Wieroński
0d7b48a8f5 gh-137952: update csv.Sniffer().has_header() docs to describe the actual off-by-onish behavior (GH-137953)
* checks 21, not 20
* Say "header" instead of "first row" to disambiguate per review.

---------

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Maurycy Pawłowski-Wieroński <maurycy@maurycy.com>
2025-11-12 00:03:14 +00:00
J Berg
9e7340cd3b gh-139462: Make the ProcessPoolExecutor BrokenProcessPool exception report which child process terminated (GH-139486)
Report which process terminated as cause of BPE
2025-11-11 22:09:58 +00:00
Serhiy Storchaka
7906f4d96a gh-132686: Add parameters inherit_class_doc and fallback_to_class_doc for inspect.getdoc() (GH-132691) 2025-11-12 00:01:25 +02:00
Peter Bierma
37e2762ee1 gh-141004: Document PyBytes_Repr and PyBytes_DecodeEscape (GH-141407)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-11 15:32:54 -05:00
Peter Bierma
2befce86e6 gh-141004: Document PyFile_OpenCode and PyFile_OpenCodeObject (GH-141413)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-11 15:31:29 -05:00
Aniket
b5196fa15a gh-137339: Clarify host and port parameter behavior in smtplib.SMTP{_SSL} initialization (#137340)
This also documents the previously undocumented default_port parameter.

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-11 15:25:26 -05:00
Steve Dower
336154f4b0 Add documentation for Python install manager's install_dir, global_dir and download_dir (GH-140223) 2025-11-11 20:02:49 +00:00
Marco Barbosa
c903d76832 gh-139533: fix refs to code without proper markups on turtledemo doc (GH-139534)
gh-139533: fix refs to code without proper markups on turtledemo documentation
2025-11-11 11:35:55 -08:00
Peter Bierma
759a048d4b gh-141004: Document PyType_Unwatch (GH-141414) 2025-11-11 12:22:16 -05:00
John Franey
d890aba748 gh-140942: Add MIME type for .cjs extension (#140937)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-11-11 14:33:56 +00:00
Sergey B Kirpichev
d69447445c gh-141004: document Py_INFINITY and Py_NAN macros (#141145)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-11 11:13:59 +01:00
Krishna Chaitanya
92741c59f8 gh-140379: add hyperlinks to list and set (GH-140399)
add hyperlinks to list and set
2025-11-10 22:02:46 -08:00
Louis
46b58e1bb9 gh-140578: Doc: Remove sencence implying that concurrent.futures.ThreadPoolExecutor does not exist (#140689)
* Doc: Remove sencence implying that concurrent.futures.ThreadPoolExecutor does not exist

Closes #140578

* Add NEWS.d entry for gh-140578

---------

Co-authored-by: Louis Paternault <spalax@gresille.org>
2025-11-10 20:50:30 -08:00
Peter Bierma
86513f6c2e gh-141004: Document missing frame APIs (GH-141189)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-10 21:35:47 +00:00
Stan Ulbrych
ed0a5fd8ca gh-141004: Document PyType_FastSubclass (GH-141313)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-11-10 12:46:41 -05:00
Sergey B Kirpichev
88953d5deb gh-141004: Deprecate Py_MATH_El and Py_MATH_PIl macros (#141035)
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-11-10 16:36:01 +01:00
Yongzi Li
59b793b0dd gh-141343: Fix swapped words in sorted doc (GH-141348) 2025-11-10 08:55:15 -06:00
David Ellis
12837c6363 gh-137530: generate an __annotate__ function for dataclasses __init__ (GH-137711) 2025-11-10 14:57:11 +01:00
Stan Ulbrych
13fa313beb gh-139707: Specify winreg, msvcrt and winsound module availability in docs (GH-140429) 2025-11-10 14:37:34 +01:00
Karina Souza
6d710a79ea gh-140500: Update download.html instructions (#141320)
Co-authored-by: Joseph Anthony Pasquale Holsten <joseph@josephholsten.com>
2025-11-10 14:39:49 +02:00
Stan Ulbrych
df19261621 gh-141004: Document pyctype.h macros (GH-141272) 2025-11-10 05:05:06 -05:00
Stan Ulbrych
9b0179fa87 gh-141004: Document Py_DTSF_* macros (GH-141310) 2025-11-09 19:43:03 -05:00
KarnbirKhera
b618731781 gh-62480: De-personalize "Partial mocking" section in unittest.mock examples (#141321)
* Refine some wording in unittest partial mock doc

Some of the descriptions were addressed in first person,
but have now been changed to address the user reading the documentation instead.

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2025-11-09 17:45:38 -06:00
Elena O
ec85d3cbfe gh-62480: De-personalize "Mocking Unbound Methods" section in unittest.mock examples (#141322)
* Rewrite Mocking Unbound Methods paragraph to second person

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-11-09 17:42:22 -06:00
Stan Ulbrych
14c62227f9 gh-141004: Document PySuper_Type (GH-141315) 2025-11-09 14:53:56 -05:00
Lakshya Upadhyaya
6f20ea1e2d gh-140980: document SET_FUNCTION_ATTRIBUTE flag for annotate function (#141306) 2025-11-09 19:59:06 +01:00
Peter Bierma
807db68ddd gh-141004: Document PyClassMethod* and PyStaticMethod* APIs (GH-141296) 2025-11-09 13:03:38 -05:00