diff options
author | Michele Simionato <michele.simionato@gmail.com> | 2020-04-05 07:38:11 +0200 |
---|---|---|
committer | Michele Simionato <michele.simionato@gmail.com> | 2020-04-05 07:38:11 +0200 |
commit | 20a43882ca3d3771b8f76ec37c974592d7e299aa (patch) | |
tree | 5b34403572bdb5500732e168aeab3089c248e1ad | |
parent | b5c40c31ce21ce08716ea801f60b2d96eb58d55e (diff) | |
download | python-decorator-git-20a43882ca3d3771b8f76ec37c974592d7e299aa.tar.gz |
Fixed IPython
-rw-r--r-- | src/decorator.py | 4 | ||||
-rw-r--r-- | src/tests/test.py | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/decorator.py b/src/decorator.py index a6435e9..45d61a4 100644 --- a/src/decorator.py +++ b/src/decorator.py @@ -76,6 +76,7 @@ except ImportError: DEF = re.compile(r'\s*def\s*([_\w][_\w\d]*)\s*\(') POS = inspect.Parameter.POSITIONAL_OR_KEYWORD +EMPTY = inspect.Parameter.empty # basic functionality @@ -261,7 +262,8 @@ def decorator(caller, _func=None): def dec(func=None, *args, **kw): na = len(args) + 1 extras = args + tuple(kw.get(p.name, p.default) - for p in dec_params[na:]) + for p in dec_params[na:] + if p.default is not EMPTY) if func is None: return lambda func: decorate(func, caller, extras) else: diff --git a/src/tests/test.py b/src/tests/test.py index bff23bd..83e54aa 100644 --- a/src/tests/test.py +++ b/src/tests/test.py @@ -151,7 +151,7 @@ class ExtraTestCase(unittest.TestCase): @decorator def catch_config_error(method, app, *args, **kwargs): return method(app) - catch_config_error(lambda app: None) + catch_config_error(lambda app, **kw: None)(1) def test_add1(self): # similar to what IPython is doing in traitlets.config.application |