diff --git a/hy/_compat.py b/hy/_compat.py index 096282a..80d8f80 100644 --- a/hy/_compat.py +++ b/hy/_compat.py @@ -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) diff --git a/hy/compiler.py b/hy/compiler.py index 610d643..4c7af9c 100644 --- a/hy/compiler.py +++ b/hy/compiler.py @@ -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))