| Message ID | 20260715223226.3371498-3-twoerner@gmail.com |
|---|---|
| State | New |
| Headers | show |
| Series | ksparser: four argparse-type fixes plus unit coverage | expand |
diff --git a/src/wic/ksparser.py b/src/wic/ksparser.py index 24c7015b336d..a73ae56cd196 100644 --- a/src/wic/ksparser.py +++ b/src/wic/ksparser.py @@ -99,7 +99,7 @@ def overheadtype(arg): raise ArgumentTypeError("Invalid value: %r" % arg) if result < 1.0: - raise ArgumentTypeError("Overhead factor should be > 1.0" % arg) + raise ArgumentTypeError("Overhead factor should be > 1.0, not %r" % arg) return result
overheadtype() rejects a factor below 1.0, but the error path read raise ArgumentTypeError("Overhead factor should be > 1.0" % arg) The message string carries no %-placeholder, so the `% arg` interpolation itself raised TypeError ("not all arguments converted during string formatting") before the ArgumentTypeError could be constructed. Every out-of-range value (0.0, 0.5, -1.0, -inf) crashed with an opaque TypeError instead of the intended argument error. Add the missing placeholder so the offending value is reported and the correct ArgumentTypeError is raised. AI-Generated: codex/claude-opus 4.8 (xhigh) Signed-off-by: Trevor Woerner <twoerner@gmail.com> --- src/wic/ksparser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)