Message344861
parsing two different strings produces identical ast.Str nodes:
import ast
txt1 = '"""\\n"""'
txt2 = '"""\n"""'
tree1 = ast.parse(txt1)
tree2 = ast.parse(txt2)
print(tree1.body[0].value.s == tree2.body[0].value.s)
print(bytes(tree1.body[0].value.s, encoding='utf-8'))
print(bytes(tree2.body[0].value.s, encoding='utf-8'))
>>> True
>>> b'\n'
>>> b'\n'
Expected result: I should be able to distinguish between the nodes created from two different strings. |
|
Date |
User |
Action |
Args |
2019-06-06 19:41:45 | Ilya Kamenshchikov | set | recipients:
+ Ilya Kamenshchikov |
2019-06-06 19:41:45 | Ilya Kamenshchikov | set | messageid: <1559850105.87.0.562031777923.issue37182@roundup.psfhosted.org> |
2019-06-06 19:41:45 | Ilya Kamenshchikov | link | issue37182 messages |
2019-06-06 19:41:45 | Ilya Kamenshchikov | create | |
|