Closed eliasdorneles closed 6 years ago
Actually, should this issue be generalised to include escaping within the quotes, or should it be a separate issue? There is a partial fix that handles edge cases for representing/escaping various non-printable characters (but not the outer quotes) in newly-closed #465, and I'm wondering where to track that.
CPython ref: unicodeobject.c
Well the first issue (created by @eliasdorneles) would be fixed by #578 but still there things to be done to get this closer to the CPython ref.
@eliasdorneles can i take up this issue?
This seems to be up for grabs, so I'm going to see what I can do with it. If I don't make traction, I will come back and make a note to that effect. @eliasdorneles tagging you in case you want to remove the "Up for grabs" flag. (not sure what your preferred procedure is)
@jonkiparsky feel free to have a look around! However, I was just checking and the specific case I reported seems that it was already implemented... Did you find anything?
@eliasdorneles
Yep, looks good from here.
(env) [jpk@Jons-MacBook-Pro-2/~/code/voc-dev/jpk_test: Sun May 20 15:45]:547 $ java -classpath ../voc/dist/python-java-support.jar:. python.quote_test
'hello'
hello'
'hello
"'hello"'
(env) [jpk@Jons-MacBook-Pro-2/~/code/voc-dev/jpk_test: Sun May 20 15:45]:548 $ python3 quote_test.py
'hello'
hello'
'hello
"'hello"'
(env) [jpk@Jons-MacBook-Pro-2/~/code/voc-dev/jpk_test: Sun May 20 15:45]:549 $ cat quote_test.py
class quote_test(object):
s = "'hello'"
t = "hello'"
u = "'hello"
v = '"\'hello"\''
print(s)
print(t)
print(u)
print(v)
(env) [jpk@Jons-MacBook-Pro-2/~/code/voc-dev/jpk_test: Sun May 20 15:46]:550 $
I suppose this issue can be closed?
Yup, seems like it! Closing it now, thanks for digging! :+1:
This is what CPython does:
Code compiled with VOC is currently working like this:
It would be nice to have
Str.__repr__
handling these cases, this will make testing easier.