pyteal icon indicating copy to clipboard operation
pyteal copied to clipboard

Getter method `byte_srt` of `Bytes`

Open cusma opened this issue 3 years ago • 1 comments

Subject of the issue

Getter method byte_srt of Bytes returns a string containing quotation marks.

Your environment

pyteal: 0.10.1

Steps to reproduce

Bytes('foo').byte_str

Expected behaviour

'foo'

Actual behaviour

"'foo'"

Priority

Very low.

cusma avatar May 27 '22 14:05 cusma

Hi, I think this trace back to the implementation in this line: https://github.com/algorand/pyteal/blob/master/pyteal/ast/bytes.py#L49, where escapeStr was called.

The escapeStr was implemented in https://github.com/algorand/pyteal/blob/master/pyteal/util.py, where the function returns string surrounded with double quotes.

I am not too sure of what was the motivation behind the design, but I can look into it and see what can be done. A quick fix for it is to use unescapeStr, which revert escaped-string back.

ahangsu avatar Jul 25 '22 16:07 ahangsu