diff options
| author | Sylvain Thénault <sylvain.thenault@logilab.fr> | 2008-05-13 12:12:50 +0200 |
|---|---|---|
| committer | Sylvain Thénault <sylvain.thenault@logilab.fr> | 2008-05-13 12:12:50 +0200 |
| commit | 179594db3d8f91a7b506dcee8a0adfde5df3eec8 (patch) | |
| tree | 35962e72c57cf4c1276f096e5874269aa019d010 | |
| parent | b791f43548cb4069d3c6f81d4a475540ebe60a58 (diff) | |
| download | astroid-git-179594db3d8f91a7b506dcee8a0adfde5df3eec8.tar.gz | |
GeneratorExit should be explicitly catched to avoid yielding additional values
| -rw-r--r-- | inference.py | 9 |
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 |
