From f283e3ccf323f4b6adda48266c5bbed4a6ffa1a2 Mon Sep 17 00:00:00 2001 From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de> Date: Tue, 11 Apr 2017 13:02:52 +0200 Subject: [PATCH] Cast options correctly --- python/dune/perftool/options.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python/dune/perftool/options.py b/python/dune/perftool/options.py index 028e160f..0d7ee593 100644 --- a/python/dune/perftool/options.py +++ b/python/dune/perftool/options.py @@ -94,12 +94,14 @@ def update_options_from_commandline(opt): def update_options_from_inifile(opt): """ Return an options array object with updated values from an inifile """ if opt.ini_file: - def _fix_bool(k, v): + def _fix_types(k, v): if hasattr(type(opt), k) and getattr(type(opt), k).type is bool: return bool(eval(v)) + if hasattr(type(opt), k): + return getattr(type(opt), k).type(v) return v ini = parse_ini_file(opt.ini_file).get("formcompiler", {}) - ini = {k: _fix_bool(k, v) for k, v in ini.items()} + ini = {k: _fix_types(k, v) for k, v in ini.items()} opt = opt.copy(**ini) return opt -- GitLab