aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-09-04 16:11:09 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-09-04 16:11:09 +0200
commit704d3aab0f25d6b0d2939f1bb4e95ca73861ca9c (patch)
tree69680c1ce0a1a296aa1ed78fdbff30f583172e67 /sources/pyside2
parentd6d31c5c277d30080a6b92de3774460048dcf49e (diff)
parentfedc289138bd912384e71a91e49ef9ee7b8a0fbb (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Diffstat (limited to 'sources/pyside2')
-rw-r--r--sources/pyside2/PySide2/__init__.py.in3
-rw-r--r--sources/pyside2/libpyside/dynamicqmetaobject.cpp3
-rw-r--r--sources/pyside2/libpyside/pysideslot.cpp16
-rw-r--r--sources/pyside2/tests/QtCore/qprocess_test.py3
4 files changed, 16 insertions, 9 deletions
diff --git a/sources/pyside2/PySide2/__init__.py.in b/sources/pyside2/PySide2/__init__.py.in
index 94683b463..035cdd636 100644
--- a/sources/pyside2/PySide2/__init__.py.in
+++ b/sources/pyside2/PySide2/__init__.py.in
@@ -65,7 +65,8 @@ def _setupQtDirectories():
# Trigger signature initialization.
try:
# PYSIDE-829: Avoid non-existent attributes in compiled code (Nuitka).
- eval("type.__signature__")
+ # We now use an explicit function instead of touching a signature.
+ _init_pyside_extension()
except AttributeError:
print(dedent('''\
{stars}
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);
diff --git a/sources/pyside2/libpyside/pysideslot.cpp b/sources/pyside2/libpyside/pysideslot.cpp
index e60115450..7bfd1719a 100644
--- a/sources/pyside2/libpyside/pysideslot.cpp
+++ b/sources/pyside2/libpyside/pysideslot.cpp
@@ -47,6 +47,8 @@
#include <QtCore/QString>
#include <signature.h>
+using namespace Shiboken;
+
struct SlotData
{
QByteArray name;
@@ -136,23 +138,25 @@ PyObject *slotCall(PyObject *self, PyObject *args, PyObject * /* kw */)
callback = PyTuple_GetItem(args, 0);
Py_INCREF(callback);
- if (PyFunction_Check(callback)) {
+ if (Py_TYPE(callback)->tp_call != nullptr) {
PySideSlot *data = reinterpret_cast<PySideSlot *>(self);
if (!data->slotData)
data->slotData = new SlotData;
- if (data->slotData->name.isEmpty())
- data->slotData->name = Shiboken::String::toCString(PepFunction_GetName(callback));
-
+ if (data->slotData->name.isEmpty()) {
+ // PYSIDE-198: Use PyObject_GetAttr instead of PepFunction_GetName to support Nuitka.
+ AutoDecRef funcName(PyObject_GetAttr(callback, PyMagicName::name()));
+ data->slotData->name = String::toCString(funcName);
+ }
const QByteArray returnType = QMetaObject::normalizedType(data->slotData->resultType);
const QByteArray signature =
returnType + ' ' + data->slotData->name + '(' + data->slotData->args + ')';
if (!pySlotName)
- pySlotName = Shiboken::String::fromCString(PYSIDE_SLOT_LIST_ATTR);
+ pySlotName = String::fromCString(PYSIDE_SLOT_LIST_ATTR);
- PyObject *pySignature = Shiboken::String::fromCString(signature);
+ PyObject *pySignature = String::fromCString(signature);
PyObject *signatureList = 0;
if (PyObject_HasAttr(callback, pySlotName)) {
signatureList = PyObject_GetAttr(callback, pySlotName);
diff --git a/sources/pyside2/tests/QtCore/qprocess_test.py b/sources/pyside2/tests/QtCore/qprocess_test.py
index 2e0ad3807..daaf0843b 100644
--- a/sources/pyside2/tests/QtCore/qprocess_test.py
+++ b/sources/pyside2/tests/QtCore/qprocess_test.py
@@ -48,13 +48,14 @@ class TestQProcess (unittest.TestCase):
def testPid(self):
p = QProcess()
- p.start("dir")
+ p.start("dir", [])
p.waitForStarted()
pid = p.pid()
# We can't test the pid method result because it returns 0 when the
# process isn't running
if p.state() == QProcess.Running:
self.assertNotEqual(pid, 0)
+ p.waitForFinished()
else:
print("PROCESS ALREADY DEAD :-/")