Add nogil support. (Closes: #1117718)
Key changes
-
Introduced ABI variant control: 'ABI_VARIANTS := gil nogil', with '--disable-gil --with-suffix=t' enabled for nogil (Note: '--enable-experimental-jit' cannot be used with '--disable-gil')
-
Build system optimization: Implemented duplication of nogil tasks via '(foreach abi,(ABI_VARIANTS),$(eval (call BUILD_STATIC,(abi))))' to avoid code redundancy
-
Test adjustments: Added 'TEST_EXCLUDES += test_tools' since 'Tools/freeze/test/Makefile' uses hardcoded 'python'
-
venv fix: Added 'add-abiflags-sitepackages.diff' to fix venv sitepackages recognition after nogil build (this issue has been fixed upstream and the patch will be removed after 3.14.1 release)
-
Minimal installation: The nogil version excludes documentation, idle, tk, desktop, binfmt, etc., ensuring it's an extension rather than a rewrite of the original python3
-
Code readability: Made harmless text adjustments to rules file, such as consolidating scattered 'TEST_EXCLUDES +=' statements
Build Process:
git clone git@salsa.debian.org:ben0i0d/python3t.git
cd python3t
git checkout python3
uscan --download-current-version --verbose
dpkg-source -b .
sudo env DEB_BUILD_OPTIONS="nocheck nobench" pbuilder build ../python3.14_3.14.0-5.dsc 2>&1 | tee ../log.txt
Test Environment:
- OS: Debian GNU/Linux forky/sid (forky) x86_64
- CPU: AMD Ryzen 5 9600X (12) @ 5.68 GHz
- Memory: 30.47 GiB
- Kernel: 6.16.12+deb14+1-amd64
GIL version, single-threaded
python3.14 benchmark.py --n 512 --threads 1
Elapsed: 1.836 s
GIL version, 8 threads
python3.14 benchmark.py --n 512 --threads 8
Elapsed: 2.026 s
nogil version, single-threaded
python3.14t benchmark.py --n 512 --threads 1
Elapsed: 2.408 s
nogil version, 8 threads
python3.14t benchmark.py --n 512 --threads 8
Elapsed: 0.674 s
Both versions successfully create virtual environments and install numpy
GIL environment
python3.14 -m venv gil
source gil/bin/activate
pip install numpy
Runs normally, Elapsed: 0.003 s
nogil environment
python3.14t -m venv nogil
source nogil/bin/activate
pip install numpy
Runs normally, Elapsed: 0.009 s