aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/libshiboken/helper.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <[email protected]>2025-03-20 08:54:35 +0100
committerFriedemann Kleint <[email protected]>2025-03-20 16:44:45 +0100
commit0a6258be9fbf0812808807c5e9360f215d866a19 (patch)
tree107fcb499ec130342116e353d657c71afaf3524a /sources/shiboken6/libshiboken/helper.cpp
parentd65666b764e7079d60a496d6ad6f17bacb7f1cdb (diff)
Move helper function isCompiledMethod() to libshiboken
Pick-to: 6.9 Task-number: PYSIDE-2916 Change-Id: I6e72977bfcf95c3c28cc160e07febb84220fa505 Reviewed-by: Shyamnath Premnadh <[email protected]>
Diffstat (limited to 'sources/shiboken6/libshiboken/helper.cpp')
-rw-r--r--sources/shiboken6/libshiboken/helper.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/sources/shiboken6/libshiboken/helper.cpp b/sources/shiboken6/libshiboken/helper.cpp
index 2a22cdcf2..ab388812e 100644
--- a/sources/shiboken6/libshiboken/helper.cpp
+++ b/sources/shiboken6/libshiboken/helper.cpp
@@ -621,6 +621,14 @@ const char *typeNameOf(const char *typeIdName)
return result;
}
+bool isCompiledMethod(PyObject *method)
+{
+ return method != nullptr && method != Py_None
+ && PyObject_HasAttr(method, PyName::im_self()) != 0
+ && PyObject_HasAttr(method, PyName::im_func()) != 0
+ && PyObject_HasAttr(method, Shiboken::PyMagicName::code()) != 0;
+}
+
#if !defined(Py_LIMITED_API) && PY_VERSION_HEX >= 0x030A0000 && !defined(PYPY_VERSION)
static int _getPyVerbose()
{