diff --git a/hy/compiler.py b/hy/compiler.py index 2963496..7638893 100755 --- a/hy/compiler.py +++ b/hy/compiler.py @@ -1061,7 +1061,7 @@ class HyASTCompiler(object): expr, name=fname, args=ast.arguments( - args=[], vararg=None, kwarg=None, + args=[], vararg=None, kwarg=None, posonlyargs=[], kwonlyargs=[], kw_defaults=[], defaults=[]), body=f(parts).stmts, decorator_list=[]) @@ -1425,6 +1425,7 @@ class HyASTCompiler(object): args = ast.arguments( args=main_args, defaults=defaults, vararg=rest, + posonlyargs=[], kwonlyargs=kwonly, kw_defaults=kw_defaults, kwarg=kwargs) diff --git a/hy/macros.py b/hy/macros.py index 3c91f11..66fc3ff 100644 --- a/hy/macros.py +++ b/hy/macros.py @@ -9,7 +9,7 @@ import traceback from contextlib import contextmanager -from hy._compat import reraise +from hy._compat import reraise, PY38 from hy.models import replace_hy_obj, HyExpression, HySymbol, wrap_value from hy.lex import mangle from hy.errors import (HyLanguageError, HyMacroExpansionError, HyTypeError, @@ -398,7 +398,8 @@ def rename_function(func, new_name): return _fn -code_obj_args = ['argcount', 'kwonlyargcount', 'nlocals', 'stacksize', - 'flags', 'code', 'consts', 'names', 'varnames', - 'filename', 'name', 'firstlineno', 'lnotab', 'freevars', - 'cellvars'] +code_obj_args = ['argcount', 'posonlyargcount', 'kwonlyargcount', 'nlocals', 'stacksize', + 'flags', 'code', 'consts', 'names', 'varnames', 'filename', 'name', + 'firstlineno', 'lnotab', 'freevars', 'cellvars'] +if not PY38: + code_obj_args.remove("posonlyargcount")