aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/libpyside/dynamicqmetaobject.cpp
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2020-09-03 11:49:22 +0200
committerChristian Tismer <tismer@stackless.com>2020-09-04 10:42:01 +0200
commit2bd69b9877f7b240512f03b4df042adf9acea744 (patch)
treecb5667739064968de6b2a723da2195cccbb9d277 /sources/pyside2/libpyside/dynamicqmetaobject.cpp
parentd02b070e23c757fa72a66a4049a659f4f5c5fc77 (diff)
Add compatibility with Nuitka
This patch is based upon the old PYSIDE-198 proposal. It worked with a few changes on Python 3 with limited API disabled. When enabling the Limited API, there were a lot of crashes. This was due to the way we need to get around access to certain implementations. This showed that the original patch was wrong in the expression of bindingmanager.cpp bool isCompiled = !isMethod && Py_TYPE(method)->tp_call != nullptr; After fixing this expression with bool isCompiled = !isMethod && Py_TYPE(method) != &PyCFunction_Type && Py_TYPE(method)->tp_call != nullptr; everything worked fine with the Limited API, too. Fixes: PYSIDE-198 Task-number: PYSIDE-829 Change-Id: I4f887c639628041682052e90ba4c72aa98284e9e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside2/libpyside/dynamicqmetaobject.cpp')
-rw-r--r--sources/pyside2/libpyside/dynamicqmetaobject.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/sources/pyside2/libpyside/dynamicqmetaobject.cpp b/sources/pyside2/libpyside/dynamicqmetaobject.cpp
index efdf33ac9..2fbda3f6a 100644
--- a/sources/pyside2/libpyside/dynamicqmetaobject.cpp
+++ b/sources/pyside2/libpyside/dynamicqmetaobject.cpp
@@ -533,7 +533,8 @@ void MetaObjectBuilderPrivate::parsePythonType(PyTypeObject *type)
const int index = m_baseObject->indexOfProperty(String::toCString(key));
if (index == -1)
addProperty(String::toCString(key), value);
- } else if (PyFunction_Check(value)) {
+ } else if (Py_TYPE(value)->tp_call != nullptr) {
+ // PYSIDE-198: PyFunction_Check does not work with Nuitka.
// Register slots.
if (PyObject_HasAttr(value, slotAttrName)) {
PyObject *signatureList = PyObject_GetAttr(value, slotAttrName);