aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/libpyside
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside2/libpyside')
-rw-r--r--sources/pyside2/libpyside/CMakeLists.txt5
-rw-r--r--sources/pyside2/libpyside/pysidesignal.cpp15
2 files changed, 13 insertions, 7 deletions
diff --git a/sources/pyside2/libpyside/CMakeLists.txt b/sources/pyside2/libpyside/CMakeLists.txt
index 15879a201..3069b1ca2 100644
--- a/sources/pyside2/libpyside/CMakeLists.txt
+++ b/sources/pyside2/libpyside/CMakeLists.txt
@@ -76,13 +76,10 @@ endmacro()
# Test files.
file(GLOB_RECURSE pyside_folder_py_files "../*.py")
-# Example files.
-file(GLOB_RECURSE example_folder_py_files "../../pyside2-examples/*.py")
-
# Mostly for setup.py.
file(GLOB setup_folder_py_files "../../../*.py")
-set(other_files ${pyside_folder_py_files} ${example_folder_py_files} ${setup_folder_py_files})
+set(other_files ${pyside_folder_py_files} ${setup_folder_py_files})
add_other_files(${other_files})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
diff --git a/sources/pyside2/libpyside/pysidesignal.cpp b/sources/pyside2/libpyside/pysidesignal.cpp
index e213ff069..04b1cf1f4 100644
--- a/sources/pyside2/libpyside/pysidesignal.cpp
+++ b/sources/pyside2/libpyside/pysidesignal.cpp
@@ -433,7 +433,7 @@ PyObject* signalInstanceConnect(PyObject* self, PyObject* args, PyObject* kwds)
return 0;
}
PyObject* result = PyObject_CallObject(pyMethod, tupleArgs);
- if (result == Py_True)
+ if (result == Py_True || result == Py_False)
return result;
else
Py_XDECREF(result);
@@ -564,17 +564,26 @@ PyObject* signalCall(PyObject* self, PyObject* args, PyObject* kw)
{
PySideSignal* signal = reinterpret_cast<PySideSignal*>(self);
+ // Native C++ signals can't be called like functions, thus we throw an exception.
+ // The only way calling a signal can succeed (the Python equivalent of C++'s operator() )
+ // is when a method with the same name as the signal is attached to an object.
+ // An example is QProcess::error() (don't check the docs, but the source code of qprocess.h).
if (!signal->homonymousMethod) {
PyErr_SetString(PyExc_TypeError, "native Qt signal is not callable");
return 0;
}
descrgetfunc getDescriptor = signal->homonymousMethod->ob_type->tp_descr_get;
- Shiboken::AutoDecRef homonymousMethod(getDescriptor(signal->homonymousMethod, 0, 0));
- if (PyCFunction_GET_FLAGS(homonymousMethod.object()) & METH_STATIC)
+ // Check if there exists a method with the same name as the signal, which is also a static
+ // method in C++ land.
+ Shiboken::AutoDecRef homonymousMethod(getDescriptor(signal->homonymousMethod, 0, 0));
+ if (PyCFunction_Check(homonymousMethod)
+ && (PyCFunction_GET_FLAGS(homonymousMethod.object()) & METH_STATIC)) {
return PyCFunction_Call(homonymousMethod, args, kw);
+ }
+ // Assumes homonymousMethod is not a static method.
ternaryfunc callFunc = signal->homonymousMethod->ob_type->tp_call;
return callFunc(homonymousMethod, args, kw);
}