New submission from Amber Brown <hawk...@atleastfornow.net>:

reproducing case:

file.py:

```
"""
Hello \n blah.
"""
```

And then in a REPL (2.7 or 3+):

```
>>> import ast
>>> f = ast.parse(open("test.py", 'rb').read())
>>> f
<_ast.Module object at 0x7f609d0a4d68>
>>> f.body[0]
<_ast.Expr object at 0x7f609d0a4e10>
>>> f.body[0].value
<_ast.Str object at 0x7f609d02b780>
>>> f.body[0].value.s
'\nHello \n blah.\n'
>>> repr(f.body[0].value.s)
"'\\nHello \\n blah.\\n'"
```

Expected behaviour:
```
>>> repr(f.body[0].value.s)
"'\\nHello \\\\n blah.\\n'"
```

----------
components: Library (Lib)
messages: 342417
nosy: hawkowl
priority: normal
severity: normal
status: open
title: ast.parse outputs ast.Strs which do not differentiate between the ASCII 
codepoint 12 (literal new line) and the ASCII codepoints 134 and 156 ("\n")
versions: Python 2.7, Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36911>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to