mike bayer added the comment:

OK well, let me just note what the issue is, and I think this is pretty 
backwards-incompatible, and additionally I really can't find any reasonable way 
of working around it except for just deleting __wrapped__.  It would be nice if 
there were some recipe or documentation that could point people to how do do 
the following pattern:

import functools
import inspect

def my_wrapper(fn):
    def wrapped(x, y, z):
        return my_func(x, y)
    wrapped = functools.update_wrapper(wrapped, fn)
    return wrapped

def my_func(x, y):
    pass

wrapper = my_wrapper(my_func)

# passes for 2.6 - 3.3, fails on 3.4
assert inspect.getargspec(wrapper) == (['x', 'y', 'z'], None, None, None), 
inspect.getargspec(wrapper)

basically in Alembic we copy out a bunch of decorated functions out somewhere 
else using inspect(), and that code relies upon seeing the wrappers list of 
arguments, not the wrapped.   Not that Python 3.4's behavior isn't correct now, 
but this seems like something that might be somewhat common.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17482>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to