-
-
Notifications
You must be signed in to change notification settings - Fork 818
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[lang]: fix encoding of string literals #3091
fix[lang]: fix encoding of string literals #3091
Conversation
since 4a5866c, string literals have been encoded incorrectly (now enshrined in the string_to_bytes function). this commit changes the interpretation of string literals to just use the utf-8 encoding, which matches other interpretations of string literals in constant folding.
reasoning: - hex literals can no longer be interpreted as Bytes - strings can have multi-character utf-8 encoding, which would result in a discrepancy between runtime and compile-time len() (since we do not do any utf-8 decoding at runtime).
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3091 +/- ##
=======================================
Coverage 91.99% 92.00%
=======================================
Files 119 119
Lines 16673 16662 -11
Branches 2803 2801 -2
=======================================
- Hits 15339 15330 -9
+ Misses 916 915 -1
+ Partials 418 417 -1 ☔ View full report in Codecov by Sentry. |
@@ -11,7 +11,7 @@ | |||
import warnings | |||
from typing import Generic, List, TypeVar, Union | |||
|
|||
from vyper.exceptions import CompilerPanic, DecimalOverrideException, InvalidLiteral, VyperException | |||
from vyper.exceptions import CompilerPanic, DecimalOverrideException, VyperException |
Check notice
Code scanning / CodeQL
Cyclic import Note
vyper.exceptions
from what i understand the issue originated in how we encoded strings - different code sections used different encodings. can we add an utility for encoding that would called whenever we need to encode something? eg in
which relies on the default encoding - would be better to be explicit and specify the encoding and use the same function everywhere |
What I did
fix #3088, fix #2799
How I did it
How to verify it
Commit message
Description for the changelog
Cute Animal Picture