Skip to content

Fix Py_UNICODE_TODECIMAL definition for PyPy#6078

Open
ngoldbaum wants to merge 2 commits into
PyO3:mainfrom
ngoldbaum:fix-todecimal-pypy
Open

Fix Py_UNICODE_TODECIMAL definition for PyPy#6078
ngoldbaum wants to merge 2 commits into
PyO3:mainfrom
ngoldbaum:fix-todecimal-pypy

Conversation

@ngoldbaum
Copy link
Copy Markdown
Contributor

@ngoldbaum ngoldbaum commented May 28, 2026

PyPy doesn't expose _PyUnicode_ToDecimalDigit, so this definition leads to an unknown symbol error at link time. I'm not sure why the existing pypy tests didn't catch this. I was able to trigger it by running the maturin test integration::integration_cases::case_16_pyo3_stub_generation_zig with a zig compiler and pypy3.11-7.3.22 installed on an ARM Mac.

Py_UNICODE_TODECIMAL is exposed in the PyPy C API, so we can just expose it directly: https://github.com/pypy/pypy/blob/872e7d92ee361276e84844b7fab208dc73c93a11/pypy/module/cpyext/unicodeobject.py#L186-L193

That fixes the linker error for me in my local testing.

@ngoldbaum ngoldbaum force-pushed the fix-todecimal-pypy branch from 04f8186 to 88d34b3 Compare May 28, 2026 14:51
Comment thread pyo3-ffi/src/cpython/unicodeobject.rs
Co-authored-by: Bas Schoenmaeckers <7943856+bschoenmaeckers@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix CI-skip-changelog Skip checking changelog entry FFI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants