Skip to content

Add range validation to binary Writer#911

Closed
rickwierenga wants to merge 2 commits intomainfrom
add-range-validation-to-binary-writer
Closed

Add range validation to binary Writer#911
rickwierenga wants to merge 2 commits intomainfrom
add-range-validation-to-binary-writer

Conversation

@rickwierenga
Copy link
Member

Summary

  • Writer integer methods (u8/u16/u32/u64/i8/i16/i32/i64) now validate that values fit in the target data type before packing
  • Raises ValueError with a clear message instead of letting struct.pack raise a cryptic struct.error

Test plan

  • Existing tests pass (no behavioral change for valid inputs)
  • Out-of-range values now raise ValueError instead of struct.error

🤖 Generated with Claude Code

rickwierenga and others added 2 commits February 27, 2026 22:29
Writer.u8/u16/u32/u64/i8/i16/i32/i64 now raise ValueError with a clear
message when the value is out of range for the data type, instead of
letting struct.pack raise a cryptic struct.error.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant