Skip to content

Commit abc2709

Browse files
sourcehawkclaude
andcommitted
fix(skills/bounding-heavy-commands): reject a --measure-rows value that is not ASCII digits
str.isdigit() accepts characters such as a superscript two, which int() cannot read, so such a value ended the wrapper with a traceback in place of its option error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 02b50da commit abc2709

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

‎skills/bounding-heavy-commands/scripts/bounded_run.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,7 @@ def parse_arguments(argv: Sequence[str]) -> Options:
973973
options.label = value
974974
elif flag == "--measure-rows":
975975
parts = value.split(",")
976-
if not all(part.isdigit() and int(part) >= 1 for part in parts):
976+
if not all(re.fullmatch(r"[0-9]+", part) and int(part) >= 1 for part in parts):
977977
raise WrapperError("cannot read --measure-rows '%s'; use whole numbers of 1 or more, such as 16,8,4" % value)
978978
options.rows = sorted(set(int(part) for part in parts), reverse=True)
979979
options.measure = True

‎skills/bounding-heavy-commands/scripts/tests/test_bounded_run.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,6 +1218,7 @@ def test_rejects_bad_rows_and_labels(self):
12181218
["--measure-rows", "two", "--", "tool"],
12191219
["--measure-rows", "", "--", "tool"],
12201220
["--measure-rows", "4,,2", "--", "tool"],
1221+
["--measure-rows", "\u00b2", "--", "tool"],
12211222
["--measure-rows", "4,2", "--cpus", "2", "--", "tool"],
12221223
["--measure", "--label", "unit tests", "--", "tool"],
12231224
["--measure", "--label", "-", "--", "tool"],

0 commit comments

Comments
 (0)