summaryrefslogtreecommitdiff
path: root/astroid/util.py
diff options
context:
space:
mode:
authorCeridwen <ceridwenv@gmail.com>2015-09-21 16:33:32 -0400
committerCeridwen <ceridwenv@gmail.com>2015-09-21 16:33:32 -0400
commit5789efaa3963569bc1060cfee5f15726d806e70c (patch)
tree34806989657c0f66f1afb338d1fc8508ce18909b /astroid/util.py
parent93fb564e69b77c1b697e942f39de3bdd1172399b (diff)
downloadastroid-5789efaa3963569bc1060cfee5f15726d806e70c.tar.gz
Add helper function for reraising exceptions
Diffstat (limited to 'astroid/util.py')
-rw-r--r--astroid/util.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/astroid/util.py b/astroid/util.py
index 8dde9b9..ceacb12 100644
--- a/astroid/util.py
+++ b/astroid/util.py
@@ -19,6 +19,17 @@
# The code in this file was originally part of logilab-common, licensed under
# the same license.
+import sys
+
+import six
+
+
+def reraise(exception):
+ '''Reraises an exception with the traceback from the current exception
+ block.'''
+ six.reraise(type(exception), exception, sys.exc_info()[2])
+
+
class _Yes(object):
"""Special inference object, which is returned when inference fails."""
def __repr__(self):