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
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
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