Skip to content

fix: add input validation to chunks() for size < 1 - #864

Closed
KooshaPari wants to merge 1 commit into
simonw:mainfrom
KooshaPari:fix-6-chunks-validation
Closed

KooshaPari wants to merge 1 commit into
simonw:mainfrom
KooshaPari:fix-6-chunks-validation

Conversation

@KooshaPari

@KooshaPari KooshaPari commented Sep 13, 2026

Copy link
Copy Markdown

Bug

chunks() with size=0 or negative size raised an unhelpful ValueError: Stop argument for islice() must be None or an integer: 0 <= x <= sys.maxsize instead of a clear error message.

Fix

Added input validation at the start of chunks() that raises ValueError with a descriptive message: "chunk size must be at least 1, got {size}".

Testing

  • Added test_chunks_size_zero_raises to verify size=0 raises ValueError
  • Added test_chunks_negative_size_raises to verify negative sizes raise ValueError
  • All 21 tests in test_utils.py pass

📚 Documentation preview 📚: https://sqlite-utils--864.org.readthedocs.build/en/864/

Copilot AI lite review requested due to automatic review settings September 13, 2026 06:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@KooshaPari KooshaPari closed this by deleting the head repository Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants