Skip to content

make wrap_all more robust #6

@kurtbrose

Description

@kurtbrose

First: wrapping builtins (e.g. setattr from object) raises exceptions

        File "/services/shopkick_pylons/shopkick_pylons-current/py/lib/python2.6/site-packages/boltons/funcutils.py", line 488, in from_func
             'module': func.__module__,
        AttributeError: 'wrapper_descriptor' object has no attribute '__module__'

Probably the way to fix is to add a filter for hasattr('module').

Second: wrapping @staticmethod breaks because the descriptor protocol that elides off the self parameter gets "erased" in the wrapped function

A bunch of different ways to fix

Finally, it would be convenient if the skip function could take the object itself as well as the name in order to work-around these issues and any other unanticipated ones. (Maybe parameters similar to descriptor protocol get / set for the skip argument to wrap_all?

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