Re: Building a C extension that uses PyDictKeysObject on Pypy 3

Matti Picus <[email protected]> Sun, 13 Mar 2022 00:33:58 +0200
Newsgroups gmane.comp.python.pypy
Message-ID <[email protected]>
On 12/3/22 23:20, Marco Sulla wrote:
> 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?

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-8083064623681286567.html

[1] https://cffi.readthedocs.io/en/latest/

[2] https://cppyy.readthedocs.io/en/latest/

_______________________________________________
pypy-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/pypy-dev.python.org/
Member address: [email protected]