
Hello. Sorry for posting in the dev mailing list, I did not found an user list for Pypy. I developed a C extension for CPython 3.6+. This extension uses PyDictKeysObject. I tried to enable Pypy in cibuildwheel, but I get a compilation error for PyDictKeysObject. What object can be used by C extension in Pypy instead of PyDictKeysObject?

On 12/3/22 23:20, Marco Sulla wrote:
This is the correct place to post, welcome. PyDictKeysObject is a CPython implementation detail, and not meant to be used even with CPython. The declaration is found in the cpython/Include/cpython/ directory. In general, we would recommend not writing c-extension modules for PyPy, rather providing a pure python version of your library since in 99% of cases it will be faster than going through the C-API emulation [0]. If you really have to use C, we would recommend you use CFFI [1] or CPPYY [2]. Matti [0] https://www.pypy.org/posts/2018/09/inside-cpyext-why-emulating-cpython-c-808... [1] https://cffi.readthedocs.io/en/latest/ [2] https://cppyy.readthedocs.io/en/latest/

Matti Picus wrote:
Ah ok, I supposed it was public API because it doesn't have an underscore at the begin... Unluckily I suppose I have to use it. It's not a problem anyway, because...
In general, we would recommend not writing c-extension modules for PyPy, rather providing a pure python version of your library
...because I have a pure py implementation. Thank you for the support.

On 12/3/22 23:20, Marco Sulla wrote:
This is the correct place to post, welcome. PyDictKeysObject is a CPython implementation detail, and not meant to be used even with CPython. The declaration is found in the cpython/Include/cpython/ directory. In general, we would recommend not writing c-extension modules for PyPy, rather providing a pure python version of your library since in 99% of cases it will be faster than going through the C-API emulation [0]. If you really have to use C, we would recommend you use CFFI [1] or CPPYY [2]. Matti [0] https://www.pypy.org/posts/2018/09/inside-cpyext-why-emulating-cpython-c-808... [1] https://cffi.readthedocs.io/en/latest/ [2] https://cppyy.readthedocs.io/en/latest/

Matti Picus wrote:
Ah ok, I supposed it was public API because it doesn't have an underscore at the begin... Unluckily I suppose I have to use it. It's not a problem anyway, because...
In general, we would recommend not writing c-extension modules for PyPy, rather providing a pure python version of your library
...because I have a pure py implementation. Thank you for the support.
participants (2)
-
Marco Sulla
-
Matti Picus