diff options
author | Michele Simionato <michele.simionato@gmail.com> | 2011-09-01 11:40:06 +0200 |
---|---|---|
committer | Michele Simionato <michele.simionato@gmail.com> | 2011-09-01 11:40:06 +0200 |
commit | 651bc5b6e0b820d77048598fea50180d8613aa72 (patch) | |
tree | 6a25b16e2625d774debc834388cd20f575e836b4 | |
parent | d84abb0c315ed045fa2809d74c4b7465c291517d (diff) | |
download | micheles-651bc5b6e0b820d77048598fea50180d8613aa72.tar.gz |
Fixed a bug with __kwdefaults__ for Python 3
-rw-r--r-- | decorator/CHANGES.txt | 2 | ||||
-rw-r--r-- | decorator/documentation3.py | 9 | ||||
-rw-r--r-- | decorator/src/decorator.py | 3 |
3 files changed, 13 insertions, 1 deletions
diff --git a/decorator/CHANGES.txt b/decorator/CHANGES.txt index ea4fd30..cbc1913 100644 --- a/decorator/CHANGES.txt +++ b/decorator/CHANGES.txt @@ -1,6 +1,8 @@ HISTORY ---------- +3.3.2 Fixed a bug with __kwdefaults__ for Python 3, submitted by Chris + Ellison (01/09/2011) 3.3.1 Fixed a doctest broken for Python 3.2, as noted by Arfrever Frehtes Taifersar Arahesis; changed the name of the attribute ``undecorated`` to ``__wrapped__`` following the diff --git a/decorator/documentation3.py b/decorator/documentation3.py index a154f30..47d9c80 100644 --- a/decorator/documentation3.py +++ b/decorator/documentation3.py @@ -1054,5 +1054,14 @@ def a_test_for_pylons(): 'The good old factorial' """ +def test_kwonlydefaults(): + """ + >>> @trace + ... def f(arg, defarg=1, *args, kwonly=2): pass + ... + >>> f.__kwdefaults__ + {'kwonly': 2} + """ + if __name__ == '__main__': import doctest; doctest.testmod() diff --git a/decorator/src/decorator.py b/decorator/src/decorator.py index 67e2221..5daf10b 100644 --- a/decorator/src/decorator.py +++ b/decorator/src/decorator.py @@ -28,7 +28,7 @@ Decorator module, see http://pypi.python.org/pypi/decorator for the documentation. """ -__version__ = '3.3.1' +__version__ = '3.3.2' __all__ = ["decorator", "FunctionMaker", "partial"] @@ -127,6 +127,7 @@ class FunctionMaker(object): func.__doc__ = getattr(self, 'doc', None) func.__dict__ = getattr(self, 'dict', {}) func.func_defaults = getattr(self, 'defaults', ()) + func.__kwdefaults__ = getattr(self, 'kwonlydefaults', None) callermodule = sys._getframe(3).f_globals.get('__name__', '?') func.__module__ = getattr(self, 'module', callermodule) func.__dict__.update(kw) |