Replies: 2 comments 1 reply
-
There are hundreds if not thousands of c-api functions, and they must be implemented by hand. See issues #3327 and #3397 for discussions of implementing a limited API mode in PyPy and tools to compare PyPy's headers to CPython's headers. The c-api functions that return a |
Beta Was this translation helpful? Give feedback.
-
I think so |
Beta Was this translation helpful? Give feedback.
-
Background: One of the packages I maintain for conda-forge (Qiskit) had been building a PyPy variant without issue until its most recent release (1.0.0). In the new release, it added a new Rust crate bound using PyO3. In previous releases, it had already been binding to two other crates without error. The new crate failed to build to because it uses
PyModule_GetFilename
which PyPy does not support. I reported the build issue to Qiskit in Qiskit/qiskit#11822, but I don't know if anyone uses the PyPy build. So the question was if it was worth the effort to keep the project compatible with PyPy. ThePyModule_GetFilename
use could be avoided but there was a concern that new issues could keep coming in new releases.So what I was wondering about was why does PyPy not implement
PyModule_GetFilename
? It seems like a fairly simple function (return the__file__
of a module) but maybe I am missing subtleties. I noticed the FAQ says that support for extensions that use the C-API is "almost complete." From https://github.com/orgs/pypy/discussions/4884#discussioncomment-8309845, I take that it is difficult to support the C-API and the hope is that HPy will solve this. Qiskit uses theabi3
mode of PyO3 which I think means it only uses the limited stable C-API of Python. I would have hoped that PyPy would have support for the limited stabl C-API for compatibility with CPython extensions, but I don't know much about how hard this is. I was mainly interested in how much of a problem compatibility would be with a project targeting the limited stable C-API with PyO3 but didn't have the resources to test against PyPy.Beta Was this translation helpful? Give feedback.
All reactions