aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2021-02-10 12:59:38 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-02-10 14:49:45 +0000
commit52de54ebc3e8f8a09b826cfee3f6ca84290de9ff (patch)
treede475b013438e62b0973c57a7dce58290e6b993a
parent8e3c5f981a802cd0731b548b2a7503821338759c (diff)
signature: Provide fixes and improvements, Part 1, addendum
This patch had a way too complicated method to find out if something is a method, and this broke on Python 2 because we don't have the __qualname__ attribute everywhere. But this can be done much easier: We check the type and see if it is a function or builtin function. Everything else must be a method, no matter what it is :) Change-Id: I07e5690f36e4ed4d50ea5e203233b369dc70fa5f Task-number: PYSIDE-510 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit 609bd8121b9a45846b236ecf51226da026651d51) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py
index c90ad05f0..400c36de5 100644
--- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py
+++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py
@@ -48,6 +48,7 @@ by producing a lot of clarity.
"""
import sys
+import types
from shibokensupport.signature import inspect
from shibokensupport.signature import get_signature as get_sig
@@ -80,12 +81,10 @@ class ExactEnumerator(object):
def is_method(self):
"""
Is this function a method?
- We check if it is not in a sub-structure
+ We check if it is a simple function.
"""
- func = self.func
- if hasattr(func, "__func__"):
- func = func.__func__
- return func.__name__ != func.__qualname__
+ tp = type(self.func)
+ return tp not in (types.BuiltinFunctionType, types.FunctionType)
def after_enum(self):
ret = self._after_enum