diff options
| author | Alexandre Fayolle <alexandre.fayolle@logilab.fr> | 2008-05-13 12:24:51 +0200 |
|---|---|---|
| committer | Alexandre Fayolle <alexandre.fayolle@logilab.fr> | 2008-05-13 12:24:51 +0200 |
| commit | 11bad6e288e4da559d45110046d380a9d9c54d6f (patch) | |
| tree | dd59557564bcb76104f22bc09062cafa99ca0e56 /inference.py | |
| parent | 5f6404d1769b6be47810b1cb7e988d02e3677fcf (diff) | |
| parent | 179594db3d8f91a7b506dcee8a0adfde5df3eec8 (diff) | |
| download | astroid-git-11bad6e288e4da559d45110046d380a9d9c54d6f.tar.gz | |
merge
Diffstat (limited to 'inference.py')
| -rw-r--r-- | inference.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/inference.py b/inference.py index 692999b0..cee88fe2 100644 --- a/inference.py +++ b/inference.py @@ -24,7 +24,6 @@ from __future__ import generators __doctype__ = "restructuredtext en" from copy import copy -import sys from logilab.common.compat import imap, chain, set @@ -33,10 +32,7 @@ from logilab.astng import MANAGER, YES, InferenceContext, Instance, Generator, \ from logilab.astng import ASTNGError, InferenceError, UnresolvableName, \ NoDefault, NotFoundError, ASTNGBuildingException -if sys.version_info < (2, 5): - class GeneratorExit(Exception): - pass - + def path_wrapper(func): """return the given infer function wrapped to handle the path""" def wrapped(node, context=None, _func=func, **kwargs): @@ -61,6 +57,11 @@ def path_wrapper(func): raise return wrapped +try: + GeneratorExit # py >= 2.5 +except: + class GeneratorExit(Exception): pass + # .infer method ############################################################### def infer_default(self, context=None): @@ -460,7 +461,7 @@ def _infer_operator(self, context=None, impl=None, meth='__method__'): continue try: value = impl(lhsvalue, rhsvalue) - except TypeError: + except: # TypeError: yield YES continue if type(value) is type(lhsvalue): |
