From 02da65279db7e0d04fa2db298881623f2e921238 Mon Sep 17 00:00:00 2001 From: Leonardo Gama Date: Fri, 10 Jun 2022 14:36:53 +0000 Subject: [PATCH] Update method related types to CPython 3.7 and PyPy 3.7 @mmckerns, it seems that PyPy changed its types and I need these to make #475 pass on Travis. --- dill/_dill.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/dill/_dill.py b/dill/_dill.py index 89f2c464..25dc7975 100644 --- a/dill/_dill.py +++ b/dill/_dill.py @@ -56,7 +56,8 @@ def _trace(boolean): from threading import _RLock as RLockType #from io import IOBase from types import CodeType, FunctionType, MethodType, GeneratorType, \ - TracebackType, FrameType, ModuleType, BuiltinMethodType + TracebackType, FrameType, ModuleType, BuiltinMethodType, MethodWrapperType, \ + MethodDescriptorType, WrapperDescriptorType, ClassMethodDescriptorType BufferType = memoryview #XXX: unregistered ClassType = type # no 'old-style' classes EllipsisType = type(Ellipsis) @@ -210,16 +211,7 @@ def numpydtype(obj): return False class _member(object): __slots__ = ['descriptor'] MemberDescriptorType = type(_member.descriptor) -if IS_PYPY: - WrapperDescriptorType = MethodType - MethodDescriptorType = FunctionType - ClassMethodDescriptorType = FunctionType -else: - WrapperDescriptorType = type(type.__repr__) - MethodDescriptorType = type(type.__dict__['mro']) - ClassMethodDescriptorType = type(type.__dict__['__prepare__' if PY3 else 'mro']) -MethodWrapperType = type([].__repr__) PartialType = type(partial(int,base=2)) SuperType = type(super(Exception, TypeError())) ItemGetterType = type(itemgetter(0))