New submission from Ilya Kamenshchikov <ikamenshchi...@gmail.com>:
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. ---------- components: Library (Lib) messages: 344861 nosy: Ilya Kamenshchikov priority: normal severity: normal status: open title: ast - handling new line inside a string type: behavior versions: Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue37182> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com