-
-
Notifications
You must be signed in to change notification settings - Fork 849
fix[codegen]: fix bytes copying routines for 0-length case #4649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix[codegen]: fix bytes copying routines for 0-length case #4649
Conversation
optimize is not called for is_complex_ir
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4649 +/- ##
==========================================
- Coverage 92.53% 92.53% -0.01%
==========================================
Files 129 129
Lines 18593 18604 +11
Branches 3225 3228 +3
==========================================
+ Hits 17205 17215 +10
- Misses 942 943 +1
Partials 446 446 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@@ -146,6 +146,10 @@ def parse_HexBytes(self): | |||
def _make_bytelike(cls, context, typeclass, bytez): | |||
bytez_length = len(bytez) | |||
btype = typeclass(bytez_length) | |||
|
|||
if bytez_length == 0: | |||
return IRnode.from_list("~empty", typ=btype, annotation=f"empty {btype}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i will just add context for future me.. we added this if statement to make some fast-path-out optimizations easier to detect. e.g. in make_bytearray_coppier
we now directly store to destination if we detect empty
without having to load anything
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's just merge charles-cooper#86 and we should be good to go
…bytes-zero-length add empty() tests
This reverts commit 6b88100. it's in PR vyperlang#4644
What I did
per title. per #4645 and #4644 (and their associated security advisories) it is difficult, but not impossible, to construct an empty bytestring which has side effects. for hygiene, don't fastpath out the side effects for zero-length bytestrings
How I did it
How to verify it
Commit message
Description for the changelog
Cute Animal Picture