Message3914

Author pjenvey
Recipients pjenvey, sreimers
Date 2008-12-11.05:38:08
SpamBayes Score 0.0
Marked as misclassified No
Message-id <1228973926.44.0.317724963399.issue1161@psf.upfronthosting.co.za>
In-reply-to
Content
We only needed to support builtin modules in find_module, not other 
things (like meta_path), so this was actually a fairly easy fix -- r5735

With this change pylint gets farther, but I ran into 3 more issues:

  File "/Users/pjenvey/src/java/jython/jython-pylons2/Lib/site-
packages/logilab.pylintinstaller-0.15.2-
py2.5.egg/logilab/astng/builder.py", line 34, in <module>
    from parser import ParserError
ImportError: No module named parser

Which is an unused import that can be safely removed

  File "/Users/pjenvey/src/java/jython/jython-pylons2/Lib/site-
packages/pylint-0.15.2-py2.5.egg/pylint/checkers/utils.py", line 77, in 
<module>
    builtins = __builtins__.copy()

__builtins__ is a CPython implementation detail that pylint/logilab 
references a few times. You'll want to import the __builtin__ module and 
use that instead

The final issue is probably more dire, in that logilab.astng seems to be 
a heavy user of the compiler module. Jython doesn't support it and never 
will, because a) it generates .pyc bytecode that we don't use b) it 
heavily relies on the parser module which we will never support either 
c) is pending deprecation and was removed in Python 3

The parser module provides the low level innards of CPython's parser 
(which is really nothing like ours), and the way to deal with AST going 
forward is via the _ast module, which we support and was originally 
added in CPython 2.5. We also support the ast module, as well as the 
ability to pass modified/generated AST to the compile function, which 
were both added in CPython 2.6.

So migrating away from the compiler module will benefit pylint on Jython 
2.5 as well as Python 3

$ pylint b.py 
No config file found, using default configuration
Traceback (most recent call last):
  File "/Users/pjenvey/src/java/jython/jython-pylons2/Lib/site-
packages/logilab.pylintinstaller-0.15.2-
py2.5.egg/logilab/astng/manager.py", line 110, in astng_from_file
    astng = ASTNGBuilder(self).file_build(filepath, modname)
  File "/Users/pjenvey/src/java/jython/jython-pylons2/Lib/site-
packages/logilab.pylintinstaller-0.15.2-
py2.5.egg/logilab/astng/builder.py", line 219, in file_build
    node = self.string_build(data, modname, path)
  File "/Users/pjenvey/src/java/jython/jython-pylons2/Lib/site-
packages/logilab.pylintinstaller-0.15.2-
py2.5.egg/logilab/astng/builder.py", line 229, in string_build
    return self.ast_build(parse(data + '\n'), modname, path)
  File 
"/Users/pjenvey/src/java/jython/dist/Lib/compiler/transformer.py", line 
51, in parse
    return Transformer().parsesuite(buf)
  File 
"/Users/pjenvey/src/java/jython/dist/Lib/compiler/transformer.py", line 
121, in parsesuite
    return self.transform(parser.suite(text))
AttributeError: 'NoneType' object has no attribute 'suite'
************* Module b
F:  1: <class 'logilab.astng._exceptions.ASTNGBuildingException'>: 
Unable to load module b ('NoneType' object has no attribute 'suite')
History
Date User Action Args
2008-12-11 05:38:46pjenveysetmessageid: <1228973926.44.0.317724963399.issue1161@psf.upfronthosting.co.za>
2008-12-11 05:38:46pjenveysetrecipients: + pjenvey, sreimers
2008-12-11 05:38:44pjenveylinkissue1161 messages
2008-12-11 05:38:11pjenveycreate