Fix Python 3 re-raising
This commit is contained in:
parent
f5f4384722
commit
d01b6bbacc
@ -52,3 +52,8 @@ if PY3:
|
|||||||
long_type = int
|
long_type = int
|
||||||
else:
|
else:
|
||||||
long_type = long # NOQA
|
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)
|
||||||
|
@ -38,7 +38,7 @@ from hy.models.cons import HyCons
|
|||||||
from hy.errors import HyCompileError, HyTypeError
|
from hy.errors import HyCompileError, HyTypeError
|
||||||
|
|
||||||
import hy.macros
|
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
|
from hy.macros import require, macroexpand, reader_macroexpand
|
||||||
import hy.importer
|
import hy.importer
|
||||||
|
|
||||||
@ -429,7 +429,7 @@ class HyASTCompiler(object):
|
|||||||
except HyTypeError as e:
|
except HyTypeError as e:
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
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))
|
raise HyCompileError(Exception("Unknown type: `%s'" % _type))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user