mirror of
https://github.com/python/cpython.git
synced 2026-02-21 14:41:06 +00:00
Co-authored-by: Isuru Fernando <isuruf@gmail.com> Co-authored-by: Lucas Colley <lucas.colley8@gmail.com> |
||
|---|---|---|
| .. | ||
| asan | ||
| default | ||
| freethreading | ||
| tsan-freethreading | ||
| build.sh | ||
| clone-recipe.sh | ||
| README.md | ||
CPython Pixi packages
This directory contains definitions for Pixi packages which can be built from the CPython source code.
Downstream developers can make use of these packages by adding them as Git dependencies in a Pixi workspace, like:
[dependencies]
python.git = "https://github.com/python/cpython"
python.subdirectory = "Tools/pixi-packages/asan"
This is particularly useful when developers need to build CPython from source (for example, for an ASan or TSan-instrumented build), as it does not require any manual clone or build steps. Instead, Pixi will automatically handle both the build and installation of the package.
Each package definition is contained in a subdirectory, but they share the build script
build.sh in this directory. Currently defined package variants:
defaultfreethreadingasan: ASan-instrumented buildtsan-freethreading: TSan-instrumented free-threading build
Maintenance
- Keep the
abi_tagandversionfields in eachvariants.yamlup to date with the Python version - Update
build.shfor any breaking changes in theconfigureandmakeworkflow
Opportunities for future improvement
- More package variants (such as UBSan)
- Support for Windows
- Using a single
pixi.tomlandrecipe.yamlfor all package variants is blocked on pixi-build-backends#532 and pixi#5248
Troubleshooting
TSan builds may crash on Linux with
FATAL: ThreadSanitizer: unexpected memory mapping 0x7977bd072000-0x7977bd500000
To fix it, try reducing mmap_rnd_bits:
$ sudo sysctl vm.mmap_rnd_bits
vm.mmap_rnd_bits = 32 # too high for TSan
$ sudo sysctl vm.mmap_rnd_bits=28 # reduce it
vm.mmap_rnd_bits = 28