Repository navigation
Fix byte-length validation for memoryviews - #395
Merged
AndreyVMarkelov merged 2 commits intoOct 7, 2026
Merged
Conversation
|
Hi @Shubham-Padkonde, I’ve raised this with our engineering team for further review. They’ll be able to review the pull request and address it as appropriate. |
AndreyVMarkelov
self-requested a review
October 7, 2026 17:09
AndreyVMarkelov
approved these changes
Oct 7, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #395 +/- ##
==========================================
+ Coverage 49.98% 52.36% +2.37%
==========================================
Files 37 42 +5
Lines 8808 11452 +2644
Branches 1892 2393 +501
==========================================
+ Hits 4403 5997 +1594
- Misses 4087 4922 +835
- Partials 318 533 +215
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
Bytesvalidator accepts memoryviews but checkslen(value), which counts elements (or the first dimension) rather than bytes. An eight-byte view cast to two integers is consequently reported as two bytes: valid minimum lengths fail, and maximum lengths can be exceeded.Use
memoryview.nbytesfor memoryviews while retaininglen()for bytes. The original value is returned unchanged. Regression tests cover typed and multidimensional views, including the length in the validation error.Validation: all 191 tests pass on Linux. Both new regressions fail before the fix. Changed-file Flake8 and
git diff --checkpass. The Windows run passes 189 tests and fails two platform-sensitive tests (temporary-file reopening and whitespace parsing); both pass on Linux.