From: Josh Kupershmidt Date: Tue, 15 Dec 2015 20:59:21 +0000 (-0500) Subject: Get rid of duplicate `reraise` and `raise_from_cause` definitions. X-Git-Tag: rel_0_8_4~5^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a0d124b62633ff40b1e2bfb93b5d6054ef96994f;p=thirdparty%2Fsqlalchemy%2Falembic.git Get rid of duplicate `reraise` and `raise_from_cause` definitions. --- diff --git a/alembic/util/compat.py b/alembic/util/compat.py index a9e35f0b..1cddb089 100644 --- a/alembic/util/compat.py +++ b/alembic/util/compat.py @@ -106,32 +106,6 @@ def with_metaclass(meta, base=object): return meta("%sBase" % meta.__name__, (base,), {}) ################################################ -if py3k: - def reraise(tp, value, tb=None, cause=None): - if cause is not None: - value.__cause__ = cause - if value.__traceback__ is not tb: - raise value.with_traceback(tb) - raise value - - def raise_from_cause(exception, exc_info=None): - if exc_info is None: - exc_info = sys.exc_info() - exc_type, exc_value, exc_tb = exc_info - reraise(type(exception), exception, tb=exc_tb, cause=exc_value) -else: - exec("def reraise(tp, value, tb=None, cause=None):\n" - " raise tp, value, tb\n") - - def raise_from_cause(exception, exc_info=None): - # not as nice as that of Py3K, but at least preserv - # the code line where the issue occurred - if exc_info is None: - exc_info = sys.exc_info() - exc_type, exc_value, exc_tb = exc_info - reraise(type(exception), exception, tb=exc_tb) - - if py3k: def reraise(tp, value, tb=None, cause=None): if cause is not None: