Skip to content

Commit 7ebb12f

Browse files
committed
Partially flesh out the "Implementing binary extensions" section
This makes the bullet points into proper headings and fleshes out the section on the stable ABI.
1 parent bb7b118 commit 7ebb12f

File tree

1 file changed

+47
-10
lines changed

1 file changed

+47
-10
lines changed

source/guides/packaging-binary-extensions.rst

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ wrapper modules up to date.
169169
for automatic wrapping with Cython. It also supports performance-oriented
170170
Python implementations that provide a CPython-like C-API, such as PyPy
171171
and Pyston.
172-
172+
173173
* :doc:`pybind11 <pybind11:index>` is a pure C++11 library
174174
that provides a clean C++ interface to the CPython (and PyPy) C API. It
175175
does not require a pre-processing step; it is written entirely in
@@ -230,18 +230,55 @@ The CPython :doc:`Extending and Embedding <python:extending/index>`
230230
guide includes an introduction to writing a
231231
:doc:`custom extension module in C <python:extending/extending>`.
232232

233-
..
233+
FIXME: Elaborate that all this is one of the reasons why you probably
234+
*don't* want to handcode your extension modules :)
234235

235-
FIXME
236236

237-
* mention the stable ABI (3.2+, link to the CPython C API docs)
238-
* mention the module lifecycle
239-
* mention the challenges of shared static state and subinterpreters
240-
* mention the implications of the GIL for extension modules
241-
* mention the memory allocation APIs in 3.4+
237+
Extension module lifecycle
238+
--------------------------
239+
240+
FIXME: This section needs to be fleshed out.
241+
242+
243+
Implications of shared static state and subinterpreters
244+
-------------------------------------------------------
245+
246+
FIXME: This section needs to be fleshed out.
247+
248+
249+
Implications of the GIL
250+
-----------------------
251+
252+
FIXME: This section needs to be fleshed out.
253+
254+
255+
Memory allocation APIs
256+
----------------------
257+
258+
FIXME: This section needs to be fleshed out.
259+
260+
261+
.. _cpython-stable-abi:
262+
263+
ABI Compatibility
264+
-----------------
265+
266+
The CPython C API does not guarantee ABI stability between minor releases
267+
(3.2, 3.3, 3.4, etc.). This means that, typically, if you build an
268+
extension module against one version of Python, it is only guaranteed to
269+
work with the same minor version of Python and not with any other minor
270+
versions.
271+
272+
Python 3.2 introduced the Limited API, with is a well-defined subset of
273+
Python's C API. The symbols needed for the Limited API form the
274+
"Stable ABI" which is guaranteed to be compatible across all Python 3.x
275+
versions. Wheels containing extensions built against the stable ABI use
276+
the ``abi3`` ABI tag, to reflect that they're compatible with all Python
277+
3.x versions.
242278

243-
* mention again that all this is one of the reasons why you probably *don't*
244-
want to handcode your extension modules :)
279+
CPython's :doc:`C API stability<python:c-api/stable>` page provides
280+
detailed information about the API / ABI stability guarantees, how to use
281+
the Limited API and the exact contents of the "Limited API".
245282

246283

247284
Building binary extensions

0 commit comments

Comments
 (0)