[issue32911] Doc strings no longer stored in body of AST

Francis Herne report at bugs.python.org
Thu Apr 12 20:40:49 EDT 2018


Francis Herne <mail at flherne.uk> added the comment:

Note:

Because this also applies to module-level docstrings, a rather strange effect that, for example, `ast.parse("'foo'")` is now an empty module.

While the root node is always an instance of `ast.Module`, in practice `ast.parse()` is often used with smaller fragments of source code that don't directly correspond to a complete module, and this behaviour makes no sense in such cases.

The resulting bug in kdev-python took a while to track down (because I had no immediate reason to suspect this change), and will be somewhat awkward to workaround.

I would prefer that this be reverted; it's likely to break a variety of users in strange ways.

----------
nosy: +flherne

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


More information about the Python-bugs-list mailing list