This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author zzzeek
Recipients ezio.melotti, georg.brandl, jcea, lukasz.langa, michael.foord, ncoghlan, python-dev, rhettinger, zzzeek
Date 2014-02-19.01:38:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1392773892.03.0.0611120708892.issue17482@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2014-02-19 01:38:12zzzeeksetrecipients: + zzzeek, georg.brandl, rhettinger, jcea, ncoghlan, ezio.melotti, michael.foord, lukasz.langa, python-dev
2014-02-19 01:38:12zzzeeksetmessageid: <1392773892.03.0.0611120708892.issue17482@psf.upfronthosting.co.za>
2014-02-19 01:38:12zzzeeklinkissue17482 messages
2014-02-19 01:38:10zzzeekcreate