Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make wrap_all more robust #6

Open
kurtbrose opened this issue Nov 29, 2016 · 0 comments
Open

make wrap_all more robust #6

kurtbrose opened this issue Nov 29, 2016 · 0 comments

Comments

@kurtbrose
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant