raise hy compile error on Py2.x for raise from
This commit is contained in:
parent
caa53fb095
commit
a2f917aba3
@ -680,12 +680,13 @@ class HyASTCompiler(object):
|
|||||||
ret += self.compile(expr.pop(0))
|
ret += self.compile(expr.pop(0))
|
||||||
|
|
||||||
cause = None
|
cause = None
|
||||||
if PY3:
|
if len(expr) == 2 and expr[0] == HyKeyword(":from"):
|
||||||
if len(expr) == 2:
|
if not PY3:
|
||||||
if expr[0] == HyKeyword(":from"):
|
raise HyCompileError(
|
||||||
expr.pop(0)
|
"raise from only supported in python 3")
|
||||||
cause = self.compile(expr.pop(0))
|
expr.pop(0)
|
||||||
cause = cause.expr
|
cause = self.compile(expr.pop(0))
|
||||||
|
cause = cause.expr
|
||||||
|
|
||||||
# Use ret.expr to get a literal `None`
|
# Use ret.expr to get a literal `None`
|
||||||
ret += ast.Raise(
|
ret += ast.Raise(
|
||||||
|
Loading…
Reference in New Issue
Block a user