aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/libpyside/globalreceiverv2.cpp
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2021-06-05 10:34:09 +0200
committerChristian Tismer <tismer@stackless.com>2021-06-06 18:56:13 +0200
commit857472e5e8ef511c69f02a7b70c0d83813dc5459 (patch)
treedba79392e73cf69b3841775bb94424969b6f59e8 /sources/pyside6/libpyside/globalreceiverv2.cpp
parent30ebb333394a1a98d08d9ca45186af0ec8f1a59f (diff)
nuitka: Fix slot access for compiled functions
The function DynamicSlotDataV2::key needs to handle compiled functions as well, which are not covered by a PyMethod_Check. The author of this patch is Kay Hayen. Some AutoDecref usage was then applied for simplification. Change-Id: I8d0f0c15100a385fd655a96c95a25bacb1b61f1b Fixes: PYSIDE-1589 Pick-to: 6.1 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside6/libpyside/globalreceiverv2.cpp')
-rw-r--r--sources/pyside6/libpyside/globalreceiverv2.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/sources/pyside6/libpyside/globalreceiverv2.cpp b/sources/pyside6/libpyside/globalreceiverv2.cpp
index c8a6e9f99..601e893f7 100644
--- a/sources/pyside6/libpyside/globalreceiverv2.cpp
+++ b/sources/pyside6/libpyside/globalreceiverv2.cpp
@@ -142,6 +142,12 @@ GlobalReceiverKey DynamicSlotDataV2::key(PyObject *callback)
if (PyMethod_Check(callback)) {
// PYSIDE-1422: Avoid hash on self which might be unhashable.
return {PyMethod_GET_SELF(callback), PyMethod_GET_FUNCTION(callback)};
+ } else if (PyObject_HasAttr(callback, PySide::PyName::im_func())
+ && PyObject_HasAttr(callback, PySide::PyName::im_self())) {
+ // PYSIDE-1589: Fix for slots in compiled functions
+ Shiboken::AutoDecRef self(PyObject_GetAttr(callback, PySide::PyName::im_self()));
+ Shiboken::AutoDecRef func(PyObject_GetAttr(callback, PySide::PyName::im_func()));
+ return {self, func};
}
return {nullptr, callback};
}