New submission from ProgVal: Since commit cb41b2766de646435743b6af7dd152751b54e73f (Python 3.7a0), string literals are not parsed the same way.
ast.parse("'test'").body used to be a list with one item containing 'test'; but now it is an empty list: Python 3.5.2+ (default, Dec 13 2016, 14:16:35) [GCC 6.2.1 20161124] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import ast >>> print(ast.parse("'test'")) <_ast.Module object at 0x7fa37ae4c630> >>> print(ast.parse("'test'").body) [<_ast.Expr object at 0x7fa37ae4c630>] >>> print(ast.parse("'test'").docstring) Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'Module' object has no attribute 'docstring' Python 3.7.0a0 (default, Feb 24 2017, 21:38:30) [GCC 6.3.0 20170205] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import ast >>> print(ast.parse("'test'")) <_ast.Module object at 0x7fe2aa415eb8> >>> print(ast.parse("'test'").body) [] >>> print(ast.parse("'test'").docstring) test ---------- components: Interpreter Core messages: 288553 nosy: Valentin.Lorentz, inada.naoki priority: normal severity: normal status: open title: ast.parse parses string literals as docstrings versions: Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29646> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com