[3.14] gh-133678: Document C API third party tools (GH-134526) (#134793)

gh-133678: Document C API third party tools (GH-134526)
(cherry picked from commit c3c88064f5)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Steve Dower <steve.dower@python.org>
This commit is contained in:
Miss Islington (bot) 2025-05-27 17:45:08 +02:00 committed by GitHub
parent 00122c8b2a
commit a1b6252c88
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 46 additions and 35 deletions

View file

@ -37,24 +37,9 @@ Writing C is hard; are there any alternatives?
----------------------------------------------
There are a number of alternatives to writing your own C extensions, depending
on what you're trying to do.
.. XXX make sure these all work
`Cython <https://cython.org>`_ and its relative `Pyrex
<https://www.csse.canterbury.ac.nz/greg.ewing/python/Pyrex/>`_ are compilers
that accept a slightly modified form of Python and generate the corresponding
C code. Cython and Pyrex make it possible to write an extension without having
to learn Python's C API.
If you need to interface to some C or C++ library for which no Python extension
currently exists, you can try wrapping the library's data types and functions
with a tool such as `SWIG <https://www.swig.org>`_. `SIP
<https://github.com/Python-SIP/sip>`__, `CXX
<https://cxx.sourceforge.net/>`_ `Boost
<https://www.boost.org/libs/python/doc/index.html>`_, or `Weave
<https://github.com/scipy/weave>`_ are also
alternatives for wrapping C++ libraries.
on what you're trying to do. :ref:`Recommended third party tools <c-api-tools>`
offer both simpler and more sophisticated approaches to creating C and C++
extensions for Python.
How can I execute arbitrary Python statements from C?