[issue32911] Doc strings omitted from AST

INADA Naoki report at bugs.python.org
Thu Feb 22 07:28:52 EST 2018


INADA Naoki <songofacandy at gmail.com> added the comment:

AST is changed slightly from Python 3.7.
ast.get_docstring() works for both of 3.6 and 3.7.

$ ./python
Python 3.8.0a0 (heads/master-dirty:451d1edaf4, Feb 22 2018, 21:11:54)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ast
>>> m = ast.parse("def foo():\n   'help'")
>>> ast.get_docstring(m.body[0])
'help'

----------
nosy: +inada.naoki

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32911>
_______________________________________


More information about the Python-bugs-list mailing list