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
commit9ef518aa8f2e32efeb6d9af6c20de35831b420c1 (patch)
tree37e3051b846033eef5b6161ad3e2d5f11637b892 /astroid/context.py
parentbc7e0b781a81f68c7f01afd18d43863a18c08ed5 (diff)
downloadastroid-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.py5
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 ?