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 eric.smith
Recipients eric.smith, hawkowl, mbussonn
Date 2019-05-14.20:11:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1557864698.55.0.267370403677.issue36911@roundup.psfhosted.org>
In-reply-to
Content
The existing behavior is what I'd expect.

Using python3:

>>> import ast
>>> s = open('file.py', 'rb').read()
>>> s
b'"""\nHello \\n blah.\n"""\n'
>>> ast.dump(ast.parse(s))
"Module(body=[Expr(value=Str(s='\\nHello \\n blah.\\n'))])"
>>> eval(s)
'\nHello \n blah.\n'

As always with the AST, some information is lost. It's not designed to be able to round-trip back to the source text.
History
Date User Action Args
2019-05-14 20:11:38eric.smithsetrecipients: + eric.smith, mbussonn, hawkowl
2019-05-14 20:11:38eric.smithsetmessageid: <1557864698.55.0.267370403677.issue36911@roundup.psfhosted.org>
2019-05-14 20:11:38eric.smithlinkissue36911 messages
2019-05-14 20:11:38eric.smithcreate