Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pylint 1.6 chokes and dies on files which 1.5.6 was happy #998

Closed
tseaver opened this issue Jul 11, 2016 · 9 comments
Closed

pylint 1.6 chokes and dies on files which 1.5.6 was happy #998

tseaver opened this issue Jul 11, 2016 · 9 comments
Assignees
Labels
Blocker 🙅 Blocks the next release
Milestone

Comments

@tseaver
Copy link

tseaver commented Jul 11, 2016

Steps to reproduce

  1. git clone https://GoogleCloudPlatform/gcloud-python
  2. cd gcloud-python
  3. git checkout googleapis/google-cloud-python@aa56c9f
  4. tox -e lint --notest
  5. .tox/lint/bin/pylint --rcfile=scripts/pylint_default
    gcloud/bigtable/happybase/connection.py
  6. .tox/lint/bin/pylint --rcfile=scripts/pylint_default
    gcloud/streaming/http_wrapper.py

Current behavior

The 'happybase/connection.py' raises:

Traceback (most recent call last):
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/bin/pylint", line 11, in <module>
    sys.exit(run_pylint())
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/__init__.py", line 11, in run_pylint
    Run(sys.argv[1:])
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/lint.py", line 1308, in __init__
    linter.check(args)
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/lint.py", line 730, in check
    self._do_check(files_or_modules)
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/lint.py", line 861, in _do_check
    self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/lint.py", line 942, in check_astroid_module
    walker.walk(ast_node)
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/utils.py", line 942, in walk
    self.walk(child)
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/utils.py", line 942, in walk
    self.walk(child)
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/utils.py", line 942, in walk
    self.walk(child)
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/utils.py", line 942, in walk
    self.walk(child)
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/utils.py", line 942, in walk
    self.walk(child)
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/utils.py", line 942, in walk
    self.walk(child)
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/utils.py", line 939, in walk
    cb(astroid)
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/extensions/docparams.py", line 130, in visit_raise
    expected_excs = utils.possible_exc_types(node)
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/extensions/_check_docs_utils.py", line 73, in possible_exc_types
    excs = set(exc for exc in excs if not node_ignores_exception(node, exc))
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/extensions/_check_docs_utils.py", line 73, in <genexpr>
    excs = set(exc for exc in excs if not node_ignores_exception(node, exc))
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/extensions/_check_docs_utils.py", line 71, in <genexpr>
    excs = (exc.name for exc in astroid.unpack_infer(handler.type))
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/astroid/bases.py", line 325, in raise_if_nothing_inferred
    for node in func(*args, **kwargs):
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/astroid/node_classes.py", line 52, in unpack_infer
    inferred = next(stmt.infer(context))
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/astroid/bases.py", line 302, in wrapped
    for res in _func(node, context, **kwargs):
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/astroid/bases.py", line 329, in raise_if_nothing_inferred
    raise exceptions.InferenceError()
astroid.exceptions.InferenceError

The streaming/http_wrapper.py check raises:

Traceback (most recent call last):
  File ".tox/lint/bin/pylint", line 11, in <module>
    sys.exit(run_pylint())
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/__init__.py", line 11, in run_pylint
    Run(sys.argv[1:])
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/lint.py", line 1308, in __init__
    linter.check(args)
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/lint.py", line 730, in check
    self._do_check(files_or_modules)
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/lint.py", line 861, in _do_check
    self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/lint.py", line 942, in check_astroid_module
    walker.walk(ast_node)
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/utils.py", line 942, in walk
    self.walk(child)
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/utils.py", line 942, in walk
    self.walk(child)
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/utils.py", line 942, in walk
    self.walk(child)
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/utils.py", line 942, in walk
    self.walk(child)
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/utils.py", line 942, in walk
    self.walk(child)
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/utils.py", line 942, in walk
    self.walk(child)
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/utils.py", line 939, in walk
    cb(astroid)
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/extensions/docparams.py", line 142, in visit_raise
    self._add_raise_message(missing_excs, func_node)
  File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/lint/lib/python2.7/site-packages/pylint/extensions/docparams.py", line 286, in _add_raise_message
    args=(', '.join(sorted(missing_excs)),),
TypeError: sequence item 0: expected string, _Yes found

Expected behavior

Report errors without raising exceptions.

pylint --version output

$ .tox/lint/bin/pylint --rcfile="scripts/pylintrc_default" --version
pylint 1.6.1, 
astroid 1.4.7
Python 2.7.11 (default, Feb 22 2016, 07:44:44) 
[GCC 4.8.4]
@PCManticore
Copy link
Contributor

Thank you. Adding this for the next patch release, which should be due by next week (probably the fix will land faster!).

@AWhetter AWhetter self-assigned this Jul 11, 2016
@PCManticore
Copy link
Contributor

@AWhetter can you cherry-pick this fix into 1.6, so we could have a release
with it?
On Jul 13, 2016 9:39 PM, "Ashley Whetter" notifications@github.com wrote:

Closed #998 #998 via caa8935
caa8935
.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#998 (comment), or mute the
thread
https://github.com/notifications/unsubscribe/AAbWprsA27gQzn7xe5--o7k1vuA7tt2Nks5qVU0QgaJpZM4JJzTp
.

PCManticore pushed a commit that referenced this issue Jul 15, 2016
@PCManticore
Copy link
Contributor

@tseaver This fix should now be available in Pylint 1.6.2, freshly released.

@tseaver
Copy link
Author

tseaver commented Jul 15, 2016

@PCManticore The fix for gcloud.streaming.http_wrapper is indeed in that release. Thank you!

The gcloud.bigtable.happybase.connection issue still exists. To reproduce:

$ git clone --depth=1 https://GoogleCloudPlatform/gcloud-python
$ cd gcloud-python
$ sed -ie "s/os\.path\.join('gcloud.*connection/# &/" scripts/run_pylint.py
$ tox -e lint

Note that the failure does not occur when running pylint only against gcloud/bigtable/happybase/connection.py.

@PCManticore
Copy link
Contributor

Oh, my mistake, I thought they are the same. Looking into it.

@PCManticore
Copy link
Contributor

@tseaver I think I've identified the issue. While I'll try to make a fix in the following days, I am trying to figure out one thing you folks have set up in your project.

This can be reproduced without tox by calling PYTHONPATH=_testing /Users/vagrant/gcloud-python/.tox/lint/bin/python /Users/vagrant/gcloud-python/.tox/lint/bin/pylint --rcfile=/Users/vagrant/gcloud-python/scripts/pylintrc_default gcloud/bigtable/happybase/connection.py. Now the question is why setting up that PYTHONPATH, with a bare structure of grpc? without it, pylint infers happily the value of grpc.framework.interfaces.face.Network error, leading of course to not having any crash at all for this file.

The fix on our side should be filter out InferenceErrors from the call sites of unpack_infer, since it can raise this exception whenever it can't infer something, but this still leaves you open in the face of other potential issues with having this PYTHONPATH set up.

@PCManticore
Copy link
Contributor

Of course, paths may vary with my example.

@PCManticore
Copy link
Contributor

I just released 1.6.3, this should be fixed there. Let me know how it works for you.

@tseaver
Copy link
Author

tseaver commented Jul 18, 2016

@PCManticore Thanks, that does fix it for gcloud-python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocker 🙅 Blocks the next release
Projects
None yet
Development

No branches or pull requests

3 participants