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