Skip to content

Use of PyPyModule_FromDefAndSpec2 is broken with pypy 7.3.19 #6305

Description

@bemoody

The package cryptography-50.0.0-pp311-pypy311_pp73-manylinux_2_34_x86_64.whl, which uses PyO3, is incompatible with the PyPy interpreter in Debian 13.

$ virtualenv -ppypy3 /tmp/aa
[...]
$ /tmp/aa/bin/pip install cryptography==50.0.0
Collecting cryptography==50.0.0
  Using cached cryptography-50.0.0-pp311-pypy311_pp73-manylinux_2_34_x86_64.whl.metadata (4.3 kB)
Using cached cryptography-50.0.0-pp311-pypy311_pp73-manylinux_2_34_x86_64.whl (4.7 MB)
Installing collected packages: cryptography
Successfully installed cryptography-50.0.0
 
[notice] A new release of pip is available: 25.1.1 -> 26.2.1
[notice] To update, run: /tmp/aa/bin/pypy3 -m pip install --upgrade pip
$ /tmp/aa/bin/python
Python 3.11.11 (7.3.19+dfsg-2, Apr 11 2025, 02:57:20)
[PyPy 7.3.19 with GCC 14.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>> import cryptography.x509
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/aa/lib/pypy3.11/site-packages/cryptography/x509/__init__.py", line 7, in <module>
    from cryptography.x509 import certificate_transparency, oid, verification
  File "/tmp/aa/lib/pypy3.11/site-packages/cryptography/x509/certificate_transparency.py", line 8, in <module>
    from cryptography.hazmat.bindings._rust import x509 as rust_x509
ImportError: /tmp/aa/lib/pypy3.11/site-packages/cryptography/hazmat/bindings/_rust.pypy311-pp73-x86_64-linux-gnu.so: undefined symbol: PyPyModule_FromDefAndSpec2

The PyModule_FromDefAndSpec2 function was apparently added to PyPy in version 7.3.20. PyO3 claims to support "PyPy 7.3 (Python 3.11+)", as the "pypy311_pp73" tag implies.

The use of this function in PyO3 appears to have been added in version 0.27.0. Accordingly, cryptography version 47.0.0 (pyo3 version 0.28.3) and later appear to be broken, while cryptography version 46.0.7 (pyo3 version 0.26.0) and earlier do not have this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions