aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/libpyside/signalmanager.cpp
diff options
context:
space:
mode:
authorShyamnath Premnadh <Shyamnath.Premnadh@qt.io>2022-01-10 10:22:09 +0100
committerShyamnath Premnadh <Shyamnath.Premnadh@qt.io>2022-01-18 13:07:01 +0100
commit56f66f128566bd08f027fee46bb42a6c4f57a26e (patch)
treed6a0f87ea3251af90fe965bd79ee877918ce8cd5 /sources/pyside6/libpyside/signalmanager.cpp
parent32b811150e273dc0b92179ae0fcd4a82330d3b21 (diff)
Safe distinction of Nuitka compiled methods
Adds an extra check to see if __code__ is present. As mentioned in PYSIDE-1755, Mocks are callable objects without __code__ attribute, unlike Python Method or Functions. However, a Mock also has im_func__ and im__self attributes. We made the assumption __code__ would be present if im_func and im_self are present, and this makes it fall under the category of a compiled method. This patch makes an extra check to see if __code__ is present. If it is not, then the Slot (here Mock) is considered as a callable method. Task-number: PYSIDE-1755 Pick-to: 6.2 Change-Id: If7e8f52dfb2409cd856eec0d0b41891d751d8a69 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside6/libpyside/signalmanager.cpp')
-rw-r--r--sources/pyside6/libpyside/signalmanager.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/sources/pyside6/libpyside/signalmanager.cpp b/sources/pyside6/libpyside/signalmanager.cpp
index bf9a5a4ad..a996d1e6c 100644
--- a/sources/pyside6/libpyside/signalmanager.cpp
+++ b/sources/pyside6/libpyside/signalmanager.cpp
@@ -46,6 +46,7 @@
#include "pyside_p.h"
#include "dynamicqmetaobject.h"
#include "pysidemetafunction_p.h"
+#include "pysidestaticstrings.h"
#include <autodecref.h>
#include <basewrapper.h>
@@ -88,6 +89,12 @@ namespace {
namespace PySide {
+bool isCompiledMethod(PyObject *callback)
+{
+ return PyObject_HasAttr(callback, PySide::PyName::im_func())
+ && PyObject_HasAttr(callback, PySide::PyName::im_self())
+ && PyObject_HasAttr(callback, PySide::PyMagicName::code());
+}
PyObjectWrapper::PyObjectWrapper()
:m_me(Py_None)