Porting to ABI v14

Note

This section is a work-in-progress and will be continually updated while ABI v14 is considered experimental.

This section is intended to help bindings authors port their projects to target ABI v14. The strongest motivation for doing so is to be able to create extension modules that are able to take advantage of multiple interpreters and free-threading.

Overview

  • PEP 489 (multi-phase initialisation)

  • PEP 573 (module states)

  • opaque and mutable vs public and immutable

  • API porting definitions.

.sip Specification File Changes from v13 and v12

This section summarises the differences in .sip specification files (including handwritten code) between v14 and older versions.

  • All handwritten implementations of __hash__() must return Py_hash_t.

  • All handwritten implementations of __len__() must return Py_ssize_t.

  • %AccessCode is not supported. %GetCode should be used instead.

  • The concept of delayed dtors is no longer supported. The DelayDtor class annotation is ignored.

  • The deprecated sipIsErr error flag is not supported.

API Changes from v13 and v12

This section summarises the differences between the v14 API and older versions.

A Case Study

In this section we outline the steps taken to add ABI v14 as a target to two large projects, specifically PyQt5 (which currently targets ABI v12) and PyQt6 (which currently targets ABI v13). We are adding the new target, rather than replacing the existing one, because we still need to build the project against versions of Python prior to v3.15.