diff options
Diffstat (limited to 'sources/shiboken6/libshiboken/bindingmanager.cpp')
-rw-r--r-- | sources/shiboken6/libshiboken/bindingmanager.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/sources/shiboken6/libshiboken/bindingmanager.cpp b/sources/shiboken6/libshiboken/bindingmanager.cpp index 25cc5c00a..ca509aefd 100644 --- a/sources/shiboken6/libshiboken/bindingmanager.cpp +++ b/sources/shiboken6/libshiboken/bindingmanager.cpp @@ -369,13 +369,6 @@ SbkObject *BindingManager::retrieveWrapper(const void *cptr, PyTypeObject *typeO PyObject *BindingManager::getOverride(SbkObject *wrapper, PyObject *pyMethodName) { auto *obWrapper = reinterpret_cast<PyObject *>(wrapper); - auto *wrapper_dict = SbkObject_GetDict_NoRef(obWrapper); - if (PyObject *method = PyDict_GetItem(wrapper_dict, pyMethodName)) { - // Note: This special case was implemented for duck-punching, which happens - // in the instance dict. It does not work with properties. - Py_INCREF(method); - return method; - } Shiboken::AutoDecRef method(PyObject_GetAttr(obWrapper, pyMethodName)); if (method.isNull()) @@ -387,9 +380,9 @@ PyObject *BindingManager::getOverride(SbkObject *wrapper, PyObject *pyMethodName // crude check for them. // PYSIDE-535: This macro is redefined in a compatible way in pep384 if (PyMethod_Check(method) != 0) { - if (PyMethod_GET_SELF(method) != obWrapper) + if (PyMethod_Self(method) != obWrapper) return nullptr; - function = PyMethod_GET_FUNCTION(method); + function = PyMethod_Function(method); } else if (isCompiledMethod(method)) { Shiboken::AutoDecRef im_self(PyObject_GetAttr(method, PyName::im_self())); // Not retaining a reference inline with what PyMethod_GET_SELF does. @@ -413,13 +406,13 @@ PyObject *BindingManager::getOverride(SbkObject *wrapper, PyObject *pyMethodName if (PyObject *defaultMethod = PyDict_GetItem(parentDict.object(), pyMethodName)) { defaultFound = true; if (function != defaultMethod) - return method.release(); + return function; } } } // PYSIDE-2255: If no default method was found, use the method. if (!defaultFound) - return method.release(); + return function; return nullptr; } |