You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Call to wraps fails on decorating objects that miss __dict__ or do not support __dict__ manipulation. E.g. classes or special methods (e.g. __setattr__). Please consider this solution and/or adding 'updated' option as in functools.wraps (with 'updated=()' functools.wraps doesn't have this error).
I would be grateful if you could advise on feasibility of using wraps on decorating special methods. Does it make sense to youse wraps in this case?
@wraps(validated.__setattr__)
.venv/lib/python3.11/site-packages/makefun/main.py:874: in wraps
func_name, func_sig, doc, qualname, co_name, module_name, all_attrs = _get_args_for_wrapping(wrapped_fun, new_sig,
.venv/lib/python3.11/site-packages/makefun/main.py:964: in _get_args_for_wrapping
all_attrs = copy(getattr_partial_aware(wrapped, '__dict__'))
.venv/lib/python3.11/site-packages/makefun/main.py:110: in getattr_partial_aware
val = getattr(obj, att_name, *att_default)
E AttributeError: 'wrapper_descriptor' object has no attribute '__dict__'
The text was updated successfully, but these errors were encountered:
@wraps is nothing but a customized @with_signature so that all dict editing work is automatic.
So if you just want to modify the signature and not the __dict__ you should probably use @with_signature directly. This should work even on objects that do not have settable attributes I think. If not please provide a reproducible example, I'll check what I can do.
Call to wraps fails on decorating objects that miss __dict__ or do not support __dict__ manipulation. E.g. classes or special methods (e.g. __setattr__). Please consider this solution and/or adding 'updated' option as in functools.wraps (with 'updated=()' functools.wraps doesn't have this error).
I would be grateful if you could advise on feasibility of using wraps on decorating special methods. Does it make sense to youse wraps in this case?
The text was updated successfully, but these errors were encountered: