Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8f33c7a

Browse files
authored
[3.13]gh-127750: Fix functools.singledispatchmethod() (GH-130029)
Revertgh-107148
1 parent30ed452 commit8f33c7a

File tree

2 files changed

+2
-16
lines changed

2 files changed

+2
-16
lines changed

‎Lib/functools.py‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -958,9 +958,6 @@ def __init__(self, func):
958958
self.dispatcher=singledispatch(func)
959959
self.func=func
960960

961-
importweakref# see comment in singledispatch function
962-
self._method_cache=weakref.WeakKeyDictionary()
963-
964961
defregister(self,cls,method=None):
965962
"""generic_method.register(cls, func) -> func
966963
@@ -969,16 +966,6 @@ def register(self, cls, method=None):
969966
returnself.dispatcher.register(cls,func=method)
970967

971968
def__get__(self,obj,cls=None):
972-
ifself._method_cacheisnotNone:
973-
try:
974-
_method=self._method_cache[obj]
975-
exceptTypeError:
976-
self._method_cache=None
977-
exceptKeyError:
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-
ifself._method_cacheisnotNone:
995-
self._method_cache[obj]=_method
996-
997981
return_method
998982

999983
@property
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Remove broken:func:`functools.singledispatchmethod` caching introduced in
2+
:gh:`85160`.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp