From 0a8b26b58819b126cdca9f8825fcbcb4d586bf3c Mon Sep 17 00:00:00 2001 From: Setsugennoao <41454651+Setsugennoao@users.noreply.github.com> Date: Thu, 14 Dec 2023 21:03:20 +0100 Subject: [PATCH] Fix inject_kwargs_params for bound methods --- stgpytools/types/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/stgpytools/types/utils.py b/stgpytools/types/utils.py index a8d6337..da301be 100644 --- a/stgpytools/types/utils.py +++ b/stgpytools/types/utils.py @@ -269,6 +269,10 @@ def __get__( def _wrapper(self: T, *_args: P.args, **kwargs: P.kwargs) -> R: assert this.signature + if not isinstance(self, class_type): # type: ignore + _args = (self, *_args) # type: ignore + self = class_obj # type: ignore + if not hasattr(self, this._kwargs_name): # type: ignore from ..exceptions import CustomRuntimeError @@ -417,7 +421,7 @@ def __setattr__(self, key: str, value: Any) -> None: if key in self.__dict__: obj = self.__dict__.get(key) - if obj and type(obj) is classproperty: + if obj and isinstance(obj, classproperty): return obj.__set__(self, value) return super(classproperty.metaclass, self).__setattr__(key, value)