merge branch 'additional_unpacking_correctness'
This commit is contained in:
commit
d8abfb3653
@ -1591,11 +1591,27 @@ class HyASTCompiler(object):
|
||||
stargs = expr.pop(0)
|
||||
if stargs is not None:
|
||||
stargs = self.compile(stargs)
|
||||
if PY35:
|
||||
stargs_expr = stargs.force_expr
|
||||
ret.expr.args.append(
|
||||
ast.Starred(stargs_expr, ast.Load(),
|
||||
lineno=stargs_expr.lineno,
|
||||
col_offset=stargs_expr.col_offset)
|
||||
)
|
||||
else:
|
||||
ret.expr.starargs = stargs.force_expr
|
||||
ret = stargs + ret
|
||||
|
||||
if expr:
|
||||
kwargs = self.compile(expr.pop(0))
|
||||
if PY35:
|
||||
kwargs_expr = kwargs.force_expr
|
||||
ret.expr.keywords.append(
|
||||
ast.keyword(None, kwargs_expr,
|
||||
lineno=kwargs_expr.lineno,
|
||||
col_offset=kwargs_expr.col_offset)
|
||||
)
|
||||
else:
|
||||
ret.expr.kwargs = kwargs.force_expr
|
||||
ret = kwargs + ret
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
[operator [or_]])
|
||||
(import sys)
|
||||
|
||||
(import [hy._compat [PY33 PY34]])
|
||||
(import [hy._compat [PY33 PY34 PY35]])
|
||||
|
||||
(defn test-sys-argv []
|
||||
"NATIVE: test sys.argv"
|
||||
@ -1067,8 +1067,11 @@
|
||||
|
||||
(defn test-disassemble []
|
||||
"NATIVE: Test the disassemble function"
|
||||
(if PY35
|
||||
(assert (= (disassemble '(do (leaky) (leaky) (macros)))
|
||||
"Module(\n body=[\n Expr(value=Call(func=Name(id='leaky'), args=[], keywords=[], starargs=None, kwargs=None)),\n Expr(value=Call(func=Name(id='leaky'), args=[], keywords=[], starargs=None, kwargs=None)),\n Expr(value=Call(func=Name(id='macros'), args=[], keywords=[], starargs=None, kwargs=None))])"))
|
||||
"Module(\n body=[Expr(value=Call(func=Name(id='leaky'), args=[], keywords=[])),\n Expr(value=Call(func=Name(id='leaky'), args=[], keywords=[])),\n Expr(value=Call(func=Name(id='macros'), args=[], keywords=[]))])"))
|
||||
(assert (= (disassemble '(do (leaky) (leaky) (macros)))
|
||||
"Module(\n body=[\n Expr(value=Call(func=Name(id='leaky'), args=[], keywords=[], starargs=None, kwargs=None)),\n Expr(value=Call(func=Name(id='leaky'), args=[], keywords=[], starargs=None, kwargs=None)),\n Expr(value=Call(func=Name(id='macros'), args=[], keywords=[], starargs=None, kwargs=None))])")))
|
||||
(assert (= (disassemble '(do (leaky) (leaky) (macros)) true)
|
||||
"leaky()\nleaky()\nmacros()")))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user