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

David Wilson dw+python-ideas at hmmz.org
Thu May 7 14:32:39 CEST 2015


On Wed, May 06, 2015 at 10:23:09AM -0600, Eric Snow 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.

One of CPython's traditional strongholds is its use as an embedded
language. I've worked on a bunch of commercial projects using it in this
way, often specifically for improved performance/access to interpreter
internals, and this is not to mention the numerous free software
projects doing similar: gdb, uwsgi, mod_python, Freeswitch, and so on.

It might be better to discuss specifics of what should change in the API
besides refcounting, and hammer out concrete steps to make those changes
happen, since I doubt the C API is ever going to go away, as even if all
extension modules were rewritten today its use for embedding would still
prevent sweeping changes without upsetting a huge number of users and
mature products.


David


More information about the Python-ideas mailing list