Skip to content

Commit

Permalink
Update method related types to CPython 3.7 and PyPy 3.7
Browse files Browse the repository at this point in the history
@mmckerns, it seems that PyPy changed its types and I need these to make uqfoundation#475 pass on Travis.
  • Loading branch information
leogama authored Jun 10, 2022
1 parent dc9a1b9 commit 02da652
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions dill/_dill.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 02da652

Please sign in to comment.