Skip to content

Commit 74b7dad

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 8c687b1 commit 74b7dad

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
@@ -986,7 +986,7 @@ def parse_arguments(argv: Sequence[str]) -> Options:
986986
options.label = value
987987
elif flag == "--measure-rows":
988988
parts = value.split(",")
989-
if not all(part.isdigit() and int(part) >= 1 for part in parts):
989+
if not all(re.fullmatch(r"[0-9]+", part) and int(part) >= 1 for part in parts):
990990
raise WrapperError("cannot read --measure-rows '%s'; use whole numbers of 1 or more, such as 16,8,4" % value)
991991
options.rows = sorted(set(int(part) for part in parts), reverse=True)
992992
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)