96. Stable ABI Design Tradeoffs
What breaking the stable ABI costs, historical breakages, versioning policy, and the tradeoff against new features.
12 notes
What breaking the stable ABI costs, historical breakages, versioning policy, and the tradeoff against new features.
ctypes, cffi, and CFFI-based extension dispatch as the primary paths for calling C libraries from Python.
PyObject_Call, PyObject_CallNoArgs, argument tuple construction, and error checking after calling into Python.
Py_Initialize, PyConfig, embedding CPython in a host process, and managing interpreter lifetime.
Py_LIMITED_API version macros, symbols excluded from the limited API, and building abi3-compatible extensions.
The stable ABI symbol set, abi3 wheel tagging, and the constraints imposed by maintaining ABI compatibility.
PyCapsule_New, PyCapsule_GetPointer, and the pattern for passing opaque C pointers between extension modules.
Py_buffer, PyBUF_* flags, PyObject_GetBuffer, and implementing the buffer protocol in a custom type.
PyTypeObject slot-by-slot walkthrough: tp_new, tp_init, tp_dealloc, tp_methods, tp_getset, and inheritance.
PyModuleDef structure, PyModule_Create, multi-phase initialization (PEP 451), and module state.
Borrowed vs. owned references, Py_XDECREF patterns, and common reference counting mistakes in extensions.
Public C API overview, Include/ header organization, and the stable vs. internal API distinction.