From c71ae1a45bd6e6d0f5aebc470b35f5a7dc0d8078 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Thu, 29 Aug 2019 02:02:51 -0700 Subject: bpo-36743: __get__ is sometimes called without the owner argument (GH-12992) (GH-15589) (cherry picked from commit 0dac68f1e593c11612ed54af9edb865d398f3b05) Co-authored-by: Raymond Hettinger --- Lib/functools.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Lib/functools.py') diff --git a/Lib/functools.py b/Lib/functools.py index 64d120182b..a674a685df 100644 --- a/Lib/functools.py +++ b/Lib/functools.py @@ -400,7 +400,7 @@ class partialmethod(object): _method._partialmethod = self return _method - def __get__(self, obj, cls): + def __get__(self, obj, cls=None): get = getattr(self.func, "__get__", None) result = None if get is not None: @@ -905,7 +905,7 @@ class singledispatchmethod: """ return self.dispatcher.register(cls, func=method) - def __get__(self, obj, cls): + def __get__(self, obj, cls=None): def _method(*args, **kwargs): method = self.dispatcher.dispatch(args[0].__class__) return method.__get__(obj, cls)(*args, **kwargs) @@ -943,7 +943,7 @@ class cached_property: f"({self.attrname!r} and {name!r})." ) - def __get__(self, instance, owner): + def __get__(self, instance, owner=None): if instance is None: return self if self.attrname is None: -- cgit v1.2.1