This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Ilya Kamenshchikov
Recipients Ilya Kamenshchikov
Date 2019-06-06.19:41:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1559850105.87.0.562031777923.issue37182@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2019-06-06 19:41:45Ilya Kamenshchikovsetrecipients: + Ilya Kamenshchikov
2019-06-06 19:41:45Ilya Kamenshchikovsetmessageid: <1559850105.87.0.562031777923.issue37182@roundup.psfhosted.org>
2019-06-06 19:41:45Ilya Kamenshchikovlinkissue37182 messages
2019-06-06 19:41:45Ilya Kamenshchikovcreate