[Webkit-unassigned] [Bug 171510] check-webkit-style exits with an error while parsing Source/WebKit2/Scripts/webkit/ directory: KeyError: 'st'

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed May 3 04:30:00 PDT 2017


https://bugs.webkit.org/show_bug.cgi?id=171510

--- Comment #6 from David Kilzer (:ddkilzer) <ddkilzer at webkit.org> ---
(In reply to Daniel Bates from comment #3)
> (In reply to Daniel Bates from comment #2)
> > [...]
> > $ echo "import parser" > A.py
> 
> This should read:
> 
> $ echo "import parser" > tmp/A.py

Using Dan's test case, I can may pylint itself hit this error:

$ PYTHONPATH=`pwd`/Tools/Scripts/webkitpy/thirdparty/autoinstalled ./Tools/Scripts/webkitpy/thirdparty/autoinstalled/pylint/bin/pylint tmp/A.py tmp/parser.py 
No config file found, using default configuration
************* Module A
C:  1,0: Invalid name "A" (should match (([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$)
C:  1,0: Missing docstring
W:  1,0: Unused import parser
************* Module parser
I:  1,0: Unable to run raw checkers on built-in module parser
W:  1,0: Redefining built-in '__package__'
Traceback (most recent call last):
  File "./Tools/Scripts/webkitpy/thirdparty/autoinstalled/pylint/bin/pylint", line 4, in <module>
    lint.Run(sys.argv[1:])
  File "/.../Tools/Scripts/webkitpy/thirdparty/autoinstalled/pylint/lint.py", line 879, in __init__
    linter.check(args)
  File "/.../Tools/Scripts/webkitpy/thirdparty/autoinstalled/pylint/lint.py", line 502, in check
    self.check_astng_module(astng, walker, rawcheckers)
  File "/.../Tools/Scripts/webkitpy/thirdparty/autoinstalled/pylint/lint.py", line 574, in check_astng_module
    walker.walk(astng)
  File "/.../Tools/Scripts/webkitpy/thirdparty/autoinstalled/pylint/utils.py", line 528, in walk
    self.walk(child)
  File "/.../Tools/Scripts/webkitpy/thirdparty/autoinstalled/pylint/utils.py", line 525, in walk
    cb(astng)
  File "/.../Tools/Scripts/webkitpy/thirdparty/autoinstalled/pylint/checkers/base.py", line 157, in visit_class
    self._check_redefinition('class', node)
  File "/.../Tools/Scripts/webkitpy/thirdparty/autoinstalled/pylint/checkers/base.py", line 221, in _check_redefinition
    defined_self = node.parent.frame()[node.name]
  File "/.../Tools/Scripts/webkitpy/thirdparty/autoinstalled/logilab/astng/scoped_nodes.py", line 178, in __getitem__
    return self.locals[item][0]
KeyError: 'st'

It would appear that pylint is getting confused by the built-in 'parser' module that comes with Python itself versus the local parser.py.

That's why changing this appears to fix the pylint issue (but may cause other issues at runtime depending on how the source is run):

-import parser
+from webkit import parser

Okay, I have a fix.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170503/8f68a0c9/attachment.html>


More information about the webkit-unassigned mailing list