summaryrefslogtreecommitdiff
path: root/astroid/scoped_nodes.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
commit18fc67e6f514daf584137e20857ebd4ef22aa3ad (patch)
tree4a58c7d4c2abb965f0d66559247065ffe89441ae /astroid/scoped_nodes.py
parenta1dcb2d18a65be6034459832c91bc5eacbee3c1e (diff)
downloadastroid-git-18fc67e6f514daf584137e20857ebd4ef22aa3ad.tar.gz
Add helper function for reraising exceptions
Diffstat (limited to 'astroid/scoped_nodes.py')
-rw-r--r--astroid/scoped_nodes.py17
1 files changed, 4 insertions, 13 deletions
diff --git a/astroid/scoped_nodes.py b/astroid/scoped_nodes.py
index 4ba63b3a..71e9b8f4 100644
--- a/astroid/scoped_nodes.py
+++ b/astroid/scoped_nodes.py
@@ -26,7 +26,6 @@ from __future__ import print_function
import io
import itertools
-import sys
import warnings
import six
@@ -370,9 +369,7 @@ class Module(LocalsDictNodeNG):
try:
return [self.import_module(name, relative_only=True)]
except (exceptions.AstroidBuildingException, SyntaxError):
- six.reraise(exceptions.NotFoundError,
- exceptions.NotFoundError(name),
- sys.exc_info()[2])
+ util.reraise(exceptions.NotFoundError(name))
raise exceptions.NotFoundError(name)
def igetattr(self, name, context=None):
@@ -385,9 +382,7 @@ class Module(LocalsDictNodeNG):
return bases._infer_stmts(self.getattr(name, context),
context, frame=self)
except exceptions.NotFoundError:
- six.reraise(exceptions.InferenceError,
- exceptions.InferenceError(name),
- sys.exc_info()[2])
+ util.reraise(exceptions.InferenceError(name))
def fully_defined(self):
"""return True if this module has been built from a .py file
@@ -857,9 +852,7 @@ class FunctionDef(bases.Statement, Lambda):
return bases._infer_stmts(self.getattr(name, context),
context, frame=self)
except exceptions.NotFoundError:
- six.reraise(exceptions.InferenceError,
- exceptions.InferenceError(name),
- sys.exc_info()[2])
+ util.reraise(exceptions.InferenceError(name))
def is_method(self):
"""return true if the function node should be considered as a method"""
@@ -1452,9 +1445,7 @@ class ClassDef(mixins.FilterStmtsMixin, LocalsDictNodeNG, bases.Statement):
# class handle some dynamic attributes, return a YES object
yield util.YES
else:
- six.reraise(exceptions.InferenceError,
- exceptions.InferenceError(name),
- sys.exc_info()[2])
+ util.reraise(exceptions.InferenceError(name))
def has_dynamic_getattr(self, context=None):
"""