Open rebcabin opened 1 year ago
Workaround requires TWO things: manually interpolating the {...}
references AND removing the f
from fr
. The following works in LPython:
hex_pat : str = r'-?0[xX][0-9a-fA-F]+'
oct_pat : str = r'-?0[0-7]+'
int_pat : str = r'-?[0-9]+'
dec_pat : str = r'(-?[0-9])M'
# Not kosher Clojure
sym_pat : str = r'([_a-zA-Z][_a-zA-Z0-9@~]*)'
Yes, we should definitely implement f-strings, at least the (large) subset that can be fully done at compile time (i.e., the formatting string is known at compile time, the variables are runtime, but we know their type), such as all your examples above.
At the very least the error message must be better.
repro : https://github.com/rebcabin/lpython/tree/brian-lasr/lasr/lpython/Issue1946
The following works in ordinary CPython:
LPython produces a
SIGSEV
(after commenting out the compatibility block at the top):