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
|For Gerrit Dashboard: PYSIDE-560|
|218007,23||PEP 384-1: Estimate the problem size||5.9||pyside/pyside-setup||Status: NEW||-2||0|
|218008,23||PEP 384-2: First simple conversions||5.9||pyside/pyside-setup||Status: NEW||-2||0|
|218009,26||PEP 384-3: Replace builtin variables by Python calls||5.9||pyside/pyside-setup||Status: NEW||-2||0|
|218010,27||PEP 384-4: More not so simple cases||5.9||pyside/pyside-setup||Status: NEW||-2||0|
|218011,27||PEP 384-5: Yet some more simple functions||5.9||pyside/pyside-setup||Status: NEW||-2||0|
|218012,27||PEP 384-6: The last simple functions||5.9||pyside/pyside-setup||Status: NEW||-2||0|
|223803,19||PEP 384-8: Enable the Limited Windows Build||5.9||pyside/pyside-setup||Status: NEW||0||0|
|228425,11||PEP 384-9: Finish Limited Access to Type Objects||5.9||pyside/pyside-setup||Status: NEW||-2||0|
|229912,19||PEP 384-10: Remove the PyHeapType objects from shiboken||5.9||pyside/pyside-setup||Status: NEW||0||0|
|231965,1||WIP: Remove PepType wherever possible||5.9||pyside/pyside-setup||Status: NEW||-2||0|