Bug Description
Environment
- PyO3: 0.28 (working), 0.29 (broken)
- Python: 3.13
- Platform: aarch64 Linux (Termux/Android)
- Rust: 1.96.0
Problem
Building a PyO3 extension with abi3-py312 on aarch64 Linux / Python 3.13
produces a .so that references _Py_NoneStruct, which was removed in
Python 3.13:
ImportError: dlopen failed: cannot locate symbol "_Py_NoneStruct"
Confirmed version bisect
- PyO3 0.28 + abi3-py312 → builds cleanly, imports successfully ✅
- PyO3 0.29 + abi3-py312 → _Py_NoneStruct linked, crashes on import ❌
Proof
nm -D _core.abi3.so | grep -i none
→ U _Py_NoneStruct
strings _core.abi3.so | grep -i "limited|Py_LIMITED"
→ nothing found
Py_LIMITED_API is not being set during compilation despite abi3-py312
being enabled. PyO3 correctly guards _Py_NoneStruct behind:
#[cfg(all(not(GraalPy), not(all(Py_3_13, Py_LIMITED_API))))]
Without Py_LIMITED_API, that guard is skipped and the removed
symbol gets linked.
Reproduction
Any package using PyO3 0.29 + abi3-py312 built from source on
aarch64 Linux / Python 3.13 will reproduce this. Confirmed via
django-bolt (github.com/dj-bolt/django-bolt):
pip install django-bolt # builds from sdist on aarch64
python3 -c "import django_bolt._core"
→ ImportError: cannot locate symbol "_Py_NoneStruct"
Downgrading django-bolt to 0.7.6 (which uses PyO3 0.28) fixes it.
Impact
Affects all aarch64 Linux users building PyO3 0.29 extensions
from source, including:
- AWS Graviton instances
- Raspberry Pi
- Any ARM Linux server
- Termux/Android
Workaround
Downgrade to PyO3 0.28 until fixed.***
Steps to Reproduce
Steps to Reproduce
-
Use an aarch64 Linux machine (tested on Termux/Android)
-
Install Python 3.13
-
Create a virtual environment and activate it
-
Install any package that uses PyO3 0.29 with abi3-py312
and builds from source (no prebuilt aarch64 wheel).
Example using django-bolt:
pip install django-bolt==0.8.3
-
Try to import the extension module:
python3 -c "import django_bolt._core"
Expected Result
Module imports successfully (as it did with PyO3 0.28)
Actual Result
ImportError: dlopen failed: cannot locate symbol "_Py_NoneStruct"
Verification
nm -D _core.abi3.so | grep -i none
→ U _Py_NoneStruct
strings _core.abi3.so | grep -i "Py_LIMITED"
→ nothing (Py_LIMITED_API was never set during build)
Confirmed Bisect
- django-bolt 0.7.6 (PyO3 0.28) → works ✅
- django-bolt 0.8.3 (PyO3 0.29) → broken ❌
Backtrace
Your operating system and version
Android 14, aarch64 (Termux)
Your Python version (python --version)
3.13
Your Rust version (rustc --version)
1.96.0
Your PyO3 version
0.29.0
How did you install python? Did you use a virtualenv?
apt install python
yes using python -m venv
Additional Info
No response
Bug Description
Environment
Problem
Building a PyO3 extension with abi3-py312 on aarch64 Linux / Python 3.13
produces a .so that references _Py_NoneStruct, which was removed in
Python 3.13:
Confirmed version bisect
Proof
nm -D _core.abi3.so | grep -i none
→ U _Py_NoneStruct
strings _core.abi3.so | grep -i "limited|Py_LIMITED"
→ nothing found
Py_LIMITED_API is not being set during compilation despite abi3-py312
being enabled. PyO3 correctly guards _Py_NoneStruct behind:
Without Py_LIMITED_API, that guard is skipped and the removed
symbol gets linked.
Reproduction
Any package using PyO3 0.29 + abi3-py312 built from source on
aarch64 Linux / Python 3.13 will reproduce this. Confirmed via
django-bolt (github.com/dj-bolt/django-bolt):
Downgrading django-bolt to 0.7.6 (which uses PyO3 0.28) fixes it.
Impact
Affects all aarch64 Linux users building PyO3 0.29 extensions
from source, including:
Workaround
Downgrade to PyO3 0.28 until fixed.***
Steps to Reproduce
Steps to Reproduce
Use an aarch64 Linux machine (tested on Termux/Android)
Install Python 3.13
Create a virtual environment and activate it
Install any package that uses PyO3 0.29 with abi3-py312
and builds from source (no prebuilt aarch64 wheel).
Example using django-bolt:
pip install django-bolt==0.8.3
Try to import the extension module:
python3 -c "import django_bolt._core"
Expected Result
Module imports successfully (as it did with PyO3 0.28)
Actual Result
ImportError: dlopen failed: cannot locate symbol "_Py_NoneStruct"
Verification
nm -D _core.abi3.so | grep -i none
→ U _Py_NoneStruct
strings _core.abi3.so | grep -i "Py_LIMITED"
→ nothing (Py_LIMITED_API was never set during build)
Confirmed Bisect
Backtrace
Your operating system and version
Android 14, aarch64 (Termux)
Your Python version (
python --version)3.13
Your Rust version (
rustc --version)1.96.0
Your PyO3 version
0.29.0
How did you install python? Did you use a virtualenv?
apt install python
yes using python -m venv
Additional Info
No response