From 258a1f57482cb6f2064a61b05d091e0f16b63496 Mon Sep 17 00:00:00 2001 From: Simon Gomizelj Date: Sat, 24 Mar 2018 15:19:29 -0400 Subject: [PATCH] Fix PY37 docstring generation --- hy/compiler.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hy/compiler.py b/hy/compiler.py index d2f7fd0..6f42e2c 100755 --- a/hy/compiler.py +++ b/hy/compiler.py @@ -2071,8 +2071,12 @@ class HyASTCompiler(object): body = Result() # grab the doc string, if there is one + docstring = None if expressions and isinstance(expressions[0], HyString): - body += self.compile(expressions.pop(0)).expr_as_stmt() + docstring = expressions.pop(0) + if not PY37: + body += self.compile(docstring).expr_as_stmt() + docstring = None if expressions and isinstance(expressions[0], HyList) \ and not isinstance(expressions[0], HyExpression): @@ -2097,7 +2101,8 @@ class HyASTCompiler(object): starargs=None, kwargs=None, bases=bases_expr, - body=body.stmts) + body=body.stmts, + docstring=(None if docstring is None else str_type(docstring))) @builds("dispatch-tag-macro") @checkargs(exact=2)