aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2021-11-22 10:07:19 +0100
committerChristian Tismer <tismer@stackless.com>2021-11-22 15:42:53 +0100
commit0377d62cc71dda587b01d641bc8d13385402142c (patch)
tree5e0125b9402771f8705f48b6f8930aac8d37b63c
parente062c9d70b5560beccb696aa13d8d44e5a2332f8 (diff)
PyPySide: ensure that .pyi files are identical in both versions
PyPy has more subtle differences than expected. Especially when creating a builtin_function_or_method in C, this is different from PyPy's understanding of builtins. We need to special-case builtin types for PyPy and for our own types. This problem needs some improvements on the PyPy side. Change-Id: If9d2f562b4e4f537f049e95a55ad3cbd83b7837a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r--sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py12
1 files changed, 9 insertions, 3 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 73431220b..3db621d28 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
@@ -67,6 +67,12 @@ declared in the same class, we use `builtins.property` in the class and
all sub-classes. The same consideration holds for "overload".
"""
+_normal_functions = (types.BuiltinFunctionType, types.FunctionType)
+if hasattr(sys, "pypy_version_info"):
+ # In PyPy, there are more types because our builtin functions
+ # are created differently in C++ and not in PyPy.
+ _normal_functions += (type(get_sig),)
+
class ExactEnumerator(object):
"""
@@ -98,7 +104,7 @@ class ExactEnumerator(object):
We check if it is a simple function.
"""
tp = type(self.func)
- return tp not in (types.BuiltinFunctionType, types.FunctionType)
+ return tp not in _normal_functions
def section(self):
if hasattr(self.fmt, "section"):
@@ -170,7 +176,7 @@ class ExactEnumerator(object):
func_prop = sorted(functions + properties, key=lambda tup: tup[0])
# find out how many functions create a signature
- sigs = list(_ for _ in functions if hasattr(_[1], "__signature__") and _[1].__signature__)
+ sigs = list(_ for _ in functions if get_sig(_[1]))
self.fmt.have_body = bool(subclasses or sigs or properties or enums or init_signature)
with self.fmt.klass(class_name, class_str):
@@ -206,7 +212,7 @@ class ExactEnumerator(object):
@staticmethod
def get_signature(func):
- return func.__signature__
+ return get_sig(func)
def function(self, func_name, func, decorator=None):
self.func = func # for is_method()