Skip to content

Commit

Permalink
fix encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
tserg committed Feb 20, 2025
1 parent 77201ad commit 9fca298
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion vyper/builtins/_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,10 @@ def to_bytes_m(expr, arg, out_typ):
if isinstance(arg.typ, _BytestringT):
# handle literal bytestrings first
if isinstance(expr, vy_ast.Constant) and arg.typ.length <= out_typ.m:
arg = int(expr.value.encode("utf-8").hex(), 16)
val = expr.value
if isinstance(arg.typ, StringT):
val = expr.value.encode("utf-8")
arg = int(val.hex(), 16)

elif isinstance(arg.typ, BytesT):
bytes_val = LOAD(bytes_data_ptr(arg))
Expand Down

0 comments on commit 9fca298

Please sign in to comment.