diff --git a/hy/_compat.py b/hy/_compat.py index ddeb859..a2ab7a5 100644 --- a/hy/_compat.py +++ b/hy/_compat.py @@ -11,6 +11,7 @@ import sys, keyword, textwrap PY3 = sys.version_info[0] >= 3 PY36 = sys.version_info >= (3, 6) PY37 = sys.version_info >= (3, 7) +PY38 = sys.version_info >= (3, 8) # The value of UCS4 indicates whether Unicode strings are stored as UCS-4. # It is always true on Pythons >= 3.3, which use USC-4 on all systems. diff --git a/hy/cmdline.py b/hy/cmdline.py index f65379d..d38ec08 100644 --- a/hy/cmdline.py +++ b/hy/cmdline.py @@ -270,8 +270,9 @@ class HyREPL(code.InteractiveConsole, object): try: # Mush the two AST chunks into a single module for # conversion into Python. - new_ast = ast.Module(exec_ast.body + - [ast.Expr(eval_ast.body)]) + new_ast = ast.Module( + exec_ast.body + [ast.Expr(eval_ast.body)], + type_ignores=[]) print(astor.to_source(new_ast)) except Exception: msg = 'Exception in AST callback:\n{}\n'.format( diff --git a/hy/compiler.py b/hy/compiler.py index 32610c5..750d8d2 100755 --- a/hy/compiler.py +++ b/hy/compiler.py @@ -2131,7 +2131,7 @@ def hy_compile(tree, module, root=ast.Module, get_expr=False, key=lambda a: not (isinstance(a, ast.ImportFrom) and a.module == '__future__')) - ret = root(body=body) + ret = root(body=body, type_ignores=[]) if get_expr: expr = ast.Expression(body=expr) diff --git a/tests/native_tests/language.hy b/tests/native_tests/language.hy index 01af5d5..687376c 100644 --- a/tests/native_tests/language.hy +++ b/tests/native_tests/language.hy @@ -11,7 +11,7 @@ pytest) (import sys) -(import [hy._compat [PY3 PY37]]) +(import [hy._compat [PY3 PY37 PY38]]) (defn test-sys-argv [] "NATIVE: test sys.argv" @@ -1550,10 +1550,11 @@ cee\"} dee" "ey bee\ncee dee")) (defn test-disassemble [] "NATIVE: Test the disassemble function" (assert (= (disassemble '(do (leaky) (leaky) (macros))) (cond - [PY3 "Module( + [PY3 (.format "Module( body=[Expr(value=Call(func=Name(id='leaky'), args=[], keywords=[])), Expr(value=Call(func=Name(id='leaky'), args=[], keywords=[])), - Expr(value=Call(func=Name(id='macros'), args=[], keywords=[]))])"] + Expr(value=Call(func=Name(id='macros'), args=[], keywords=[]))]{})" + (if PY38 ",\n type_ignores=[]" ""))] [True "Module( body=[ Expr(value=Call(func=Name(id='leaky'), args=[], keywords=[], starargs=None, kwargs=None)),