From 374a4921b709b38d35e3ded943a7806d92505221 Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Thu, 7 Apr 2016 23:20:30 +0200 Subject: [PATCH] Fix bug in storage init errorhandler If there are no defaults, spec.args would be sliced like `spec.args[1:0]` which always produces an empty slice. --- vdirsyncer/utils/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vdirsyncer/utils/__init__.py b/vdirsyncer/utils/__init__.py index 5d1311d..0a480b0 100644 --- a/vdirsyncer/utils/__init__.py +++ b/vdirsyncer/utils/__init__.py @@ -114,7 +114,8 @@ def get_storage_init_args(cls, stop_at=object): all, required = set(), set() for spec in get_storage_init_specs(cls, stop_at=stop_at): all.update(spec.args[1:]) - required.update(spec.args[1:-len(spec.defaults or ())]) + last = -len(spec.defaults) if spec.defaults else len(spec.args) + required.update(spec.args[1:last]) return all, required