Fix Python 3 re-raising

This commit is contained in:
Ryan Gonzalez 2014-11-01 15:00:41 -05:00
parent f5f4384722
commit d01b6bbacc
2 changed files with 7 additions and 2 deletions

View File

@ -52,3 +52,8 @@ if PY3:
long_type = int
else:
long_type = long # NOQA
if PY3:
exec('def raise_empty(t, *args): raise t(*args) from None')
else:
def raise_empty(t, *args): raise t(*args)

View File

@ -38,7 +38,7 @@ from hy.models.cons import HyCons
from hy.errors import HyCompileError, HyTypeError
import hy.macros
from hy._compat import str_type, long_type, PY27, PY33, PY3, PY34
from hy._compat import str_type, long_type, PY27, PY33, PY3, PY34, raise_empty
from hy.macros import require, macroexpand, reader_macroexpand
import hy.importer
@ -429,7 +429,7 @@ class HyASTCompiler(object):
except HyTypeError as e:
raise
except Exception as e:
raise HyCompileError(e, sys.exc_info()[2])
raise_empty(HyCompileError, e, sys.exc_info()[2])
raise HyCompileError(Exception("Unknown type: `%s'" % _type))