diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2015-08-28 16:33:50 +0300 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2015-08-28 16:33:50 +0300 |
commit | 9ef518aa8f2e32efeb6d9af6c20de35831b420c1 (patch) | |
tree | 37e3051b846033eef5b6161ad3e2d5f11637b892 /astroid/context.py | |
parent | bc7e0b781a81f68c7f01afd18d43863a18c08ed5 (diff) | |
download | astroid-9ef518aa8f2e32efeb6d9af6c20de35831b420c1.tar.gz |
Don't raise StopIteration in InferenceContext.push, instead exit from the generator by doing an early return
This makes astroid compliant with PEP 479 changes, since in the future it will be
prohibited to exit from a generator by raising a StopIteration.
Diffstat (limited to 'astroid/context.py')
-rw-r--r-- | astroid/context.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/astroid/context.py b/astroid/context.py index bb2422a..5a2ea52 100644 --- a/astroid/context.py +++ b/astroid/context.py @@ -17,7 +17,6 @@ # with astroid. If not, see <http://www.gnu.org/licenses/>. """Various context related utilities, including inference and call contexts.""" - import contextlib import itertools @@ -38,8 +37,10 @@ class InferenceContext(object): def push(self, node): name = self.lookupname if (node, name) in self.path: - raise StopIteration() + return True + self.path.add((node, name)) + return False def clone(self): # XXX copy lookupname/callcontext ? |