From d15fdcf4444a206d9da7be51f46ba9bb24f1140e Mon Sep 17 00:00:00 2001 From: Boxiang Sun Date: Wed, 31 Aug 2016 16:35:17 +0800 Subject: [PATCH] Use a more compatable way to get wrapper_descriptor and method_wrapper The original code use type(type.__call__) to get the type `wrapper_descriptor` and use `type(all.__call__)` to get type `method_wrapper`. according the comment in here: https://github.com/Daetalus/funcsigs/blob/master/funcsigs/__init__.py#L170. It could avoid infinite recursive or sefault. In Pyston, the type of `type.__call__` is `instancemethod`. So it will cause segfault. I change it to `type(bytearray.__add__)`, because in Pyston, its type is `wrapper_descriptor`, this is also work in CPython 2.x and CPython 3.x. More information, please see https://github.com/scikit-learn/scikit-learn/pull/7162. --- funcsigs/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/funcsigs/__init__.py b/funcsigs/__init__.py index 5f5378b..c9ede7c 100644 --- a/funcsigs/__init__.py +++ b/funcsigs/__init__.py @@ -20,8 +20,8 @@ __all__ = ['BoundArguments', 'Parameter', 'Signature', 'signature'] -_WrapperDescriptor = type(type.__call__) -_MethodWrapper = type(all.__call__) +_WrapperDescriptor = type(bytearray.__add__) +_MethodWrapper = type(u'str'.__add__) _NonUserDefinedCallables = (_WrapperDescriptor, _MethodWrapper,