From: Mike Bayer Date: Wed, 19 Feb 2014 01:44:16 +0000 (-0500) Subject: - Fixed a failure of the system that allows "legacy keyword arguments" X-Git-Tag: rel_0_6_4~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a43dc5f688f4c06885ec8066b9fff1c25cb3e305;p=thirdparty%2Fsqlalchemy%2Falembic.git - Fixed a failure of the system that allows "legacy keyword arguments" to be understood, which arose as of a change in Python 3.4 regarding decorators. A workaround is applied that allows the code to work across Python 3 versions. #175 --- diff --git a/alembic/util.py b/alembic/util.py index 015f732e..26f7ac09 100644 --- a/alembic/util.py +++ b/alembic/util.py @@ -325,7 +325,15 @@ def _with_legacy_names(translations): metadata) decorated = eval(code, {"target": go}) decorated.__defaults__ = getattr(fn, '__func__', fn).__defaults__ - return update_wrapper(decorated, fn) + update_wrapper(decorated, fn) + if hasattr(decorated, '__wrapped__'): + # update_wrapper in py3k applies __wrapped__, which causes + # inspect.getargspec() to ignore the extra arguments on our + # wrapper as of Python 3.4. We need this for the + # "module class proxy" thing though, so just del the __wrapped__ + # for now. See #175 as well as bugs.python.org/issue17482 + del decorated.__wrapped__ + return decorated return decorate diff --git a/docs/build/changelog.rst b/docs/build/changelog.rst index 525e169b..bf58c6fa 100644 --- a/docs/build/changelog.rst +++ b/docs/build/changelog.rst @@ -5,6 +5,15 @@ Changelog .. changelog:: :version: 0.6.4 + .. change:: + :tags: bug, py3k + :tickets: 175 + + Fixed a failure of the system that allows "legacy keyword arguments" + to be understood, which arose as of a change in Python 3.4 regarding + decorators. A workaround is applied that allows the code to work + across Python 3 versions. + .. change:: :tags: feature :pullreq: bitbucket:20