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

wraps fails on decorating objects that miss or does not support __dict__ manipulation #94

Open
@tokarenko

Description

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__'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /