diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-08-29 02:02:51 -0700 |
---|---|---|
committer | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2019-08-29 02:02:51 -0700 |
commit | c71ae1a45bd6e6d0f5aebc470b35f5a7dc0d8078 (patch) | |
tree | 1e89af5c38142e19f260f1490423baa9ecf1f32e /Lib/functools.py | |
parent | 0d45d50e421b46b56195821580c3760b43813106 (diff) | |
download | cpython-git-c71ae1a45bd6e6d0f5aebc470b35f5a7dc0d8078.tar.gz |
bpo-36743: __get__ is sometimes called without the owner argument (GH-12992) (GH-15589)
(cherry picked from commit 0dac68f1e593c11612ed54af9edb865d398f3b05)
Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
Diffstat (limited to 'Lib/functools.py')
-rw-r--r-- | Lib/functools.py | 6 |
1 files changed, 3 insertions, 3 deletions
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: |