[Python-ideas] discouraging direct use of the C-API

Donald Stufft donald at stufft.io
Wed May 6 19:13:57 CEST 2015


> On May 6, 2015, at 12:57 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> 
> On Wed, 6 May 2015 10:23:09 -0600
> Eric Snow <ericsnowcurrently at gmail.com>
> wrote:
>> A big blocker to making certain sweeping changes to CPython (e.g.
>> ref-counting) is compatibility with the vast body of C extension
>> modules out there that use the C-API.  While there are certainly
>> drastic long-term solutions to that problem, there is one thing we can
>> do in the short-term that would at least get the ball rolling.  We can
>> put a big red note at the top of every page of the C-API docs that
>> encourages folks to either use CFFI or Cython.
> 
> CFFI is only useful for a small subset of stuff people use the C API for
> (mainly, thin wrappers around external libraries). Cython is a more
> reasonable suggestion in this context.

You can write stuff in C itself for cffi too, it’s not just for C bindings,
an example would be the .c’s and .h’s for padding and constant time compare
in the cryptography project [1].

[1] https://github.com/pyca/cryptography/tree/master/src/cryptography/hazmat/primitives/src

---
Donald Stufft
PGP: 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150506/f50503bc/attachment.sig>


More information about the Python-ideas mailing list