raise hy compile error on Py2.x for raise from

This commit is contained in:
Allison Kaptur 2014-06-09 16:33:11 -04:00
parent caa53fb095
commit a2f917aba3

View File

@ -680,9 +680,10 @@ class HyASTCompiler(object):
ret += self.compile(expr.pop(0))
cause = None
if PY3:
if len(expr) == 2:
if expr[0] == HyKeyword(":from"):
if len(expr) == 2 and expr[0] == HyKeyword(":from"):
if not PY3:
raise HyCompileError(
"raise from only supported in python 3")
expr.pop(0)
cause = self.compile(expr.pop(0))
cause = cause.expr