I got the following error while running pylint on a fairly large script in Jython on Windows XP. Pylint successfully finishes analyzing the script when this patch is applied.
Traceback (most recent call last):
File "\jython2.7a2\bin\pylint", line 8, in
sys.exit(
File "C:\jython2.7a2\Lib\site-packages\pylint-0.26.0-py2.7.egg\pylint\__init__.py", line 21, in run_pylint
Run(sys.argv[1:])
File "C:\jython2.7a2\Lib\site-packages\pylint-0.26.0-py2.7.egg\pylint\lint.py", line 929, in __init__
linter.check(args)
File "C:\jython2.7a2\Lib\site-packages\pylint-0.26.0-py2.7.egg\pylint\lint.py", line 542, in check
self.check_astng_module(astng, walker, rawcheckers)
File "C:\jython2.7a2\Lib\site-packages\pylint-0.26.0-py2.7.egg\pylint\lint.py", line 615, in check_astng_module
walker.walk(astng)
File "C:\jython2.7a2\Lib\site-packages\pylint-0.26.0-py2.7.egg\pylint\utils.py", line 556, in walk
self.walk(child)
File "C:\jython2.7a2\Lib\site-packages\pylint-0.26.0-py2.7.egg\pylint\utils.py", line 556, in walk
self.walk(child)
File "C:\jython2.7a2\Lib\site-packages\pylint-0.26.0-py2.7.egg\pylint\utils.py", line 553, in walk
cb(astng)
File "C:\jython2.7a2\Lib\site-packages\pylint-0.26.0-py2.7.egg\pylint\checkers\typecheck.py", line 168, in visit_getattr
if is_super(owner) or getattr(owner, 'type', None) == 'metaclass':
File "C:\jython2.7a2\Lib\site-packages\logilab_astng-0.24.1-py2.7.egg\logilab\astng\bases.py", line 51, in __getattr__
return getattr(self._proxied, name)
File "C:\jython2.7a2\Lib\site-packages\logilab_astng-0.24.1-py2.7.egg\logilab\astng\raw_building.py", line 347, in _set_proxied
return _CONST_PROXY[const.value.__class__]
KeyError: <type 'org.python.core.FloatInfo'>
I made a change within checkers/typecheck.py in order to prevent pylint from crashing. I think that the change is fine, but the exact nature of the crash was a bit cryptic, so someone familiar with the code in the above error should review my change to determine whether it's an appropriate fix. Here's my workaround. Starting on line 169 of checkers/typecheck.py, replace the following lines:
if is_super(owner) or getattr(owner, 'type', None) == 'metaclass':
continue
with these lines:
try:
if is_super(owner) or getattr(owner, 'type', None) == 'metaclass':
continue
except KeyError:
continue
Additional Information: I'm using JDK 6 and my Jython environment has a few very minor patches applied, but I don't think that they're anything that would affect this issue. My pylint environment is clean except for this very small workaround applied because that crash is encountered before this crash. |
Comments
-
2012/10/25 07:29, written by sthenault
add commentthe pb rather lie in underlying astng library and should be fixed there. Could you try to give here the smallest possible piece of code giving this error?
Maybe something like the following (proposition guessed from the traceback you gave):
?