@@ -958,9 +958,6 @@ def __init__(self, func):
958958 self .dispatcher = singledispatch (func )
959959 self .func = func
960960
961- import weakref # see comment in singledispatch function
962- self ._method_cache = weakref .WeakKeyDictionary ()
963-
964961 def register (self , cls , method = None ):
965962 """generic_method.register(cls, func) -> func
966963
@@ -969,16 +966,6 @@ def register(self, cls, method=None):
969966 return self .dispatcher .register (cls , func = method )
970967
971968 def __get__ (self , obj , cls = None ):
972- if self ._method_cache is not None :
973- try :
974- _method = self ._method_cache [obj ]
975- except TypeError :
976- self ._method_cache = None
977- except KeyError :
978- pass
979- else :
980- return _method
981-
982969 dispatch = self .dispatcher .dispatch
983970 funcname = getattr (self .func , '__name__' , 'singledispatchmethod method' )
984971 def _method (* args , ** kwargs ):
@@ -991,9 +978,6 @@ def _method(*args, **kwargs):
991978 _method .register = self .register
992979 update_wrapper (_method , self .func )
993980
994- if self ._method_cache is not None :
995- self ._method_cache [obj ] = _method
996-
997981 return _method
998982
999983 @property
0 commit comments