From d953826c636d131884597a69278d3d9a64bb6ed1 Mon Sep 17 00:00:00 2001 From: "Matthias J. Kannwischer" Date: Wed, 13 Aug 2025 18:04:07 +0800 Subject: [PATCH] Fix slothy-cli parser to accept "flags" as register name Remove RegisterType.from_string() conversion that was converting register names like "flags" to enums, causing AttributeError when the rest of the codebase expects strings. Also allow list-to-set type conversion. Fixes #208 --- slothy/cli/__init__.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/slothy/cli/__init__.py b/slothy/cli/__init__.py index 6f7d29bfa..13fe39902 100644 --- a/slothy/cli/__init__.py +++ b/slothy/cli/__init__.py @@ -222,6 +222,9 @@ def parse_as_float(val): def check_ty(ty_real): if ty is None or ty is type(None) or ty == ty_real: return + # Allow lists to be converted to sets + if ty == set and ty_real == list: + return raise CmdLineException( f"Configuration value {val} isn't correctly typed -- " f"expected {ty}, but got {ty_real}" @@ -242,11 +245,6 @@ def check_ty(ty_real): check_ty(bool) logger.debug("Value %s parsed as Boolean", val) return False - # Try to parse as RegisterType - ty = arch.RegisterType.from_string(val) - if ty is not None: - logger.debug("Value %s parsed as RegisterType", val) - return ty f = parse_as_float(val) if f is not None: check_ty(float)