summaryrefslogtreecommitdiff
path: root/astroid/context.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2015-08-28 16:33:50 +0300
committerClaudiu Popa <pcmanticore@gmail.com>2015-08-28 16:33:50 +0300
commitcd74a130e1bc71930db4482132c48076de4af50f (patch)
treeb1a175e65aeffb2df683ea9278cf9cbbd8f93ff6 /astroid/context.py
parent703ec99df8c2c7e8289974a0a64fc1fd10eea913 (diff)
downloadastroid-git-cd74a130e1bc71930db4482132c48076de4af50f.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.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/astroid/context.py b/astroid/context.py
index bb2422ae..5a2ea525 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 ?