From b65f78a0c79b839b6ac992486c925efd81c3edb9 Mon Sep 17 00:00:00 2001 From: "Paul R. Tagliamonte" Date: Wed, 10 Apr 2013 23:06:55 -0400 Subject: [PATCH] Adding in this barf of a hack beacuse it pleases me. --- hy/compiler.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/hy/compiler.py b/hy/compiler.py index 8c9230e..a8075e2 100644 --- a/hy/compiler.py +++ b/hy/compiler.py @@ -959,14 +959,19 @@ def hy_compile(tree, root=None): if entry in imported: continue + replace = form + if hasattr(sys, "subversion") and sys.subversion[0] == "PyPy": + # using form causes pypy to blow up; let's conditionally + # add this for cpython, since it won't go through and make + # sure the AST makes sense. Muhahaha. - PRT + replace = tree[0] + imported.add(entry) imports.append(HyExpression([ HySymbol("import_from"), HySymbol(package), HySymbol(entry) - ]).replace(tree[0])) # form)) - # using form causes pypy to blow up; let's conditionally - # add this for cpython or something. Muhahaha. - PRT + ]).replace(replace)) _ast = compiler.compile(imports) + _ast