New submission from Marius Gedminas <mar...@gedmin.as>:
Python 3.7 removes an isinstance(node.body[0], Expr) check ast.get_docstring() that makes it crash when you pass in AST nodes of modules or functions that do not have docstrings. Steps to reproduce: - git clone https://github.com/mgedmin/findimports - cd findimports - tox -e py37 The failure looks like this: Traceback (most recent call last): ... File "/home/mg/src/findimports/findimports.py", line 337, in find_imports_and_track_names visitor.visit(root) File "/home/mg/opt/python37/lib/python3.7/ast.py", line 262, in visit return visitor(node) File "/home/mg/src/findimports/findimports.py", line 169, in visitSomethingWithADocstring self.processDocstring(ast.get_docstring(node, clean=False), lineno) File "/home/mg/opt/python37/lib/python3.7/ast.py", line 211, in get_docstring node = node.body[0].value AttributeError: 'Import' object has no attribute 'value' ---------- components: Library (Lib) messages: 319453 nosy: mgedmin priority: normal severity: normal status: open title: 3.7 regression: ast.get_docstring() for a node that lacks a docstring type: behavior versions: Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33851> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com