Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-560

Support The Python Stable ABI



    • Type: Task
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.6, 5.9, dev
    • Fix Version/s: 5.9, dev
    • Component/s: PySide, Shiboken
    • Labels:
    • Technical Risk:


      Since Python 3.2, there exists a stable ABI that allows linking against Python3
      instead of enumerating each single version. This is achieved by certain restrictions.

      Try to achieve this for PySide.
      Goal: Build wheels for Python 3.5, 3.6, 3.7 etc.

      Having a deeper look at the topic revealed the following:

      The limited API changes the way how Python3 is built.
      Some macros are turned into functions, and a lot of functionality
      is simply not exposed. The setting is activated by defining
      (in our case)

      #define Py_LIMITED_API 0x03050000

      in sbkpython.h.
      Unfortunately, there are 18 modules which need more or less rigorous changes before the limited API will work.

      [Note: The former text was too optimistic and wrong, due to caching effects.]

      The one module that was completely excluded is datetime.

      I talked with the Python developers. It turned out that not very
      many projects use this feature, and it could be a little finer
      grained concerning datetime, but obviously they could not justify
      to put too much effort into this feature.

      The general advice with unsupported C-modules is to use the Python
      interface and fish the missing functions out of the interpreter
      at runtime.
      This principle can be applied to many places where direct access is not allowed.
      Things become most complicated with the typeobject file, because no direct access is allowed any longer. But there is an alternative interface which we have to learn to use.

      Py_buffer was an exception. Instead of seeking a Python replacement, the module was renamed and copied, and we will keep that version. This decision was taken from
      PyQt - they have done the same.

      Currently 17 out of 18 modules are resolved. I am right now stuck because we first need to support heap type objects. Without them, the limited API is impossible.

      References: PEP 384


          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.



              ctismer Christian Tismer
              ctismer Christian Tismer
              1 Vote for this issue
              3 Start watching this issue



                  Gerrit Reviews

                  There are no open Gerrit changes