summaryrefslogtreecommitdiff
path: root/inference.py
diff options
context:
space:
mode:
authorSylvain Thénault <sylvain.thenault@logilab.fr>2008-05-13 12:12:50 +0200
committerSylvain Thénault <sylvain.thenault@logilab.fr>2008-05-13 12:12:50 +0200
commit179594db3d8f91a7b506dcee8a0adfde5df3eec8 (patch)
tree35962e72c57cf4c1276f096e5874269aa019d010 /inference.py
parentb791f43548cb4069d3c6f81d4a475540ebe60a58 (diff)
downloadastroid-git-179594db3d8f91a7b506dcee8a0adfde5df3eec8.tar.gz
GeneratorExit should be explicitly catched to avoid yielding additional values
Diffstat (limited to 'inference.py')
-rw-r--r--inference.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/inference.py b/inference.py
index e2d41b78..99794b89 100644
--- a/inference.py
+++ b/inference.py
@@ -57,6 +57,11 @@ def path_wrapper(func):
raise
return wrapped
+try:
+ GeneratorExit # py >= 2.5
+except:
+ class GeneratorExit: pass
+
# .infer method ###############################################################
def infer_default(self, context=None):
@@ -435,6 +440,8 @@ def _infer_operator(self, context=None, impl=None, meth='__method__'):
# will be the same
lhs.getattr(meth)
yield lhs
+ except GeneratorExit:
+ raise
except:
yield YES
continue
@@ -447,6 +454,8 @@ def _infer_operator(self, context=None, impl=None, meth='__method__'):
# will be the same
rhs.getattr(meth)
yield rhs
+ except GeneratorExit:
+ raise
except:
yield YES
continue