aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2021-02-10 12:47:52 +0100
committerCristian Maureira-Fredes <Cristian.Maureira-Fredes@qt.io>2021-02-11 11:37:51 +0100
commitdb9753fc25d31e8c19abdc70408f484ab9cb34e6 (patch)
tree8cee80c2ff47f3d8b5dde2a5faf8f597cb570341
parent79ff6fc6b97148310ff40198471f15322caf3639 (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)
-rw-r--r--sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py
index 6fba0626c..21c284f88 100644
--- a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py
+++ b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py
@@ -50,6 +50,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
@@ -82,12 +83,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