diff -r 6f4e0c462daf Lib/ast.py --- a/Lib/ast.py Wed Jul 22 14:49:13 2015 +0300 +++ b/Lib/ast.py Thu Jul 23 01:13:32 2015 +0300 @@ -194,7 +194,7 @@ be found. If the node provided does not have docstrings a TypeError will be raised. """ - if not isinstance(node, (FunctionDef, ClassDef, Module)): + if not isinstance(node, (AsyncFunctionDef, FunctionDef, ClassDef, Module)): raise TypeError("%r can't have docstrings" % node.__class__.__name__) if node.body and isinstance(node.body[0], Expr) and \ isinstance(node.body[0].value, Str): diff -r 6f4e0c462daf Lib/test/test_ast.py --- a/Lib/test/test_ast.py Wed Jul 22 14:49:13 2015 +0300 +++ b/Lib/test/test_ast.py Thu Jul 23 01:13:32 2015 +0300 @@ -511,6 +511,9 @@ self.assertEqual(ast.get_docstring(node.body[0]), 'line one\nline two') + node = ast.parse('async def foo():\n """spam\n ham"""') + self.assertEqual(ast.get_docstring(node.body[0]), 'spam\nham') + def test_literal_eval(self): self.assertEqual(ast.literal_eval('[1, 2, 3]'), [1, 2, 3]) self.assertEqual(ast.literal_eval('{"foo": 42}'), {"foo": 42})