Fixes and improvements to CPython should first be contributed upstream. The Python Developer’s Guide is a great resource to guide you through the process.
That said, there are few scenarios where using python-cmake-buildsystem to patch CPython is relevant. Learn more about these at https://github.com/python-cmake-buildsystem/cpython.
By default, patches are applied at configuration time. Setting the option
PYTHON_APPLY_PATCHES to OFF allows to change this. Note that the
build system keep track which patches have been applied.
Each patch is documented by adding an entry to the README.rst file found in the same directory (or a parent directory). Whenever possible, references to bugs.python.org <http://bugs.python.org>`_(bpo) issues, corresponding `GitHub PRs and any related discussions on forums or mailing lists are also provided.
Patches are organized per python version. Patches specific to a system, a system+compiler, or a system+compiler+compiler_version are organized in corresponding sub-directories:
patches/<PY_VERSION_MAJOR>.<PY_VERSION_MINOR> patches/<PYTHON_VERSION> patches/<PYTHON_VERSION>/<CMAKE_SYSTEM_NAME> patches/<PYTHON_VERSION>/<CMAKE_SYSTEM_NAME>-<CMAKE_C_COMPILER_ID> patches/<PYTHON_VERSION>/<CMAKE_SYSTEM_NAME>-<CMAKE_C_COMPILER_ID>/<compiler_version>
where
<PYTHON_VERSION>is of the formX.Y.Z<CMAKE_SYSTEM_NAME>is a value likeDarwin,LinuxorWindows. See corresponding CMake documentation for more details.<CMAKE_C_COMPILER_ID>is a valid likeClang,GNUorMSVC. See corresponding CMake documentation for more details.<compiler_version>is set to the value ofCMAKE_C_COMPILER_VERSION(e.g5.2.1) except when using Microsoft compiler where it is set to the value ofMSVC_VERSION(e.g1900).
Before being applied, patches are sorted alphabetically. This ensures that patch starting with 0001- is applied before the one starting with 0002-.
Note that for historical reasons, there are still patches found in cmake/patches
and cmake/patches-win32 subdirectories. These will gradually be organized as
described above.