From 04f9311a2ec10fd206f8df273229dd4a6912807f Mon Sep 17 00:00:00 2001 From: Jaewook Lee Date: Wed, 15 Nov 2023 17:59:05 +0100 Subject: [PATCH] don't deepcopy ModuleImportRaiser --- gustaf/helpers/options.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gustaf/helpers/options.py b/gustaf/helpers/options.py index 6dea0158b..4ac6562c9 100644 --- a/gustaf/helpers/options.py +++ b/gustaf/helpers/options.py @@ -198,7 +198,12 @@ def make_valid_options(*options): for opt in options: if isinstance(opt, Option): # copy option object to avoid overwriting defaults - valid_options[opt.key] = deepcopy(opt) + # only exception is if this option is a backend object + # and wrapped by ModuleImportRaiser + if "ModuleImportRaiser" in str(type(opt)): + valid_options[opt.key] = opt + else: + valid_options[opt.key] = deepcopy(opt) elif isinstance(opt, SetDefault): # overwrite default of existing option. if opt.key not in valid_options: