From a43dc5f688f4c06885ec8066b9fff1c25cb3e305 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 18 Feb 2014 20:44:16 -0500 Subject: [PATCH] - 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 --- alembic/util.py | 10 +++++++++- docs/build/changelog.rst | 9 +++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) 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 -- 2.47.2