From db9753fc25d31e8c19abdc70408f484ab9cb34e6 Mon Sep 17 00:00:00 2001 From: Christian Tismer Date: Wed, 10 Feb 2021 12:47:52 +0100 Subject: 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 Reviewed-by: Cristian Maureira-Fredes (cherry picked from commit 609bd8121b9a45846b236ecf51226da026651d51) --- .../files.dir/shibokensupport/signature/lib/enum_sig.py | 9 ++++----- 1 file 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 -- cgit v1.2.3