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 crashes with nodes_of_class AttributeError #3648

Closed
natekupp opened this issue May 27, 2020 · 1 comment
Closed

pylint crashes with nodes_of_class AttributeError #3648

natekupp opened this issue May 27, 2020 · 1 comment
Assignees
Labels
Bug 🪲 Crash 💥 A bug that makes pylint crash
Milestone

Comments

@natekupp
Copy link

Steps to reproduce

  1. git clone https://github.com/dagster-io/dagster.git && cd dagster
  2. pylint -j 0 `git ls-files 'python_modules/libraries/*.py'` --rcfile=.pylintrc (this also reproes with -j 1)

Current behavior

multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/Users/nate/.pyenv/versions/3.7.6/lib/python3.7/multiprocessing/pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "/Users/nate/.pyenv/versions/3.7.6/envs/dagster37/lib/python3.7/site-packages/pylint/lint/check_parallel.py", line 69, in _worker_check_single_file
    _worker_linter.check_single_file(name, filepath, modname)
  File "/Users/nate/.pyenv/versions/3.7.6/envs/dagster37/lib/python3.7/site-packages/pylint/lint/pylinter.py", line 890, in check_single_file
    self.get_ast, check_astroid_module, name, filepath, modname
  File "/Users/nate/.pyenv/versions/3.7.6/envs/dagster37/lib/python3.7/site-packages/pylint/lint/pylinter.py", line 930, in _check_file
    check_astroid_module(ast_node)
  File "/Users/nate/.pyenv/versions/3.7.6/envs/dagster37/lib/python3.7/site-packages/pylint/lint/pylinter.py", line 1063, in check_astroid_module
    ast_node, walker, rawcheckers, tokencheckers
  File "/Users/nate/.pyenv/versions/3.7.6/envs/dagster37/lib/python3.7/site-packages/pylint/lint/pylinter.py", line 1107, in _check_astroid_module
    walker.walk(ast_node)
  File "/Users/nate/.pyenv/versions/3.7.6/envs/dagster37/lib/python3.7/site-packages/pylint/utils/ast_walker.py", line 75, in walk
    self.walk(child)
  File "/Users/nate/.pyenv/versions/3.7.6/envs/dagster37/lib/python3.7/site-packages/pylint/utils/ast_walker.py", line 75, in walk
    self.walk(child)
  File "/Users/nate/.pyenv/versions/3.7.6/envs/dagster37/lib/python3.7/site-packages/pylint/utils/ast_walker.py", line 72, in walk
    callback(astroid)
  File "/Users/nate/.pyenv/versions/3.7.6/envs/dagster37/lib/python3.7/site-packages/pylint/checkers/typecheck.py", line 1036, in visit_assign
    self._check_assignment_from_function_call(node)
  File "/Users/nate/.pyenv/versions/3.7.6/envs/dagster37/lib/python3.7/site-packages/pylint/checkers/typecheck.py", line 1072, in _check_assignment_from_function_call
    function_node.nodes_of_class(astroid.Return, skip_klass=astroid.FunctionDef)
  File "/Users/nate/.pyenv/versions/3.7.6/envs/dagster37/lib/python3.7/site-packages/astroid/node_classes.py", line 692, in nodes_of_class
    yield from child_node.nodes_of_class(klass, skip_klass)
AttributeError: 'list' object has no attribute 'nodes_of_class'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/nate/.pyenv/versions/dagster37/bin/pylint", line 8, in <module>
    sys.exit(run_pylint())
  File "/Users/nate/.pyenv/versions/3.7.6/envs/dagster37/lib/python3.7/site-packages/pylint/__init__.py", line 22, in run_pylint
    PylintRun(sys.argv[1:])
  File "/Users/nate/.pyenv/versions/3.7.6/envs/dagster37/lib/python3.7/site-packages/pylint/lint/run.py", line 344, in __init__
    linter.check(args)
  File "/Users/nate/.pyenv/versions/3.7.6/envs/dagster37/lib/python3.7/site-packages/pylint/lint/pylinter.py", line 878, in check
    files_or_modules,
  File "/Users/nate/.pyenv/versions/3.7.6/envs/dagster37/lib/python3.7/site-packages/pylint/lint/check_parallel.py", line 101, in check_parallel
    _worker_check_single_file, files
  File "/Users/nate/.pyenv/versions/3.7.6/lib/python3.7/multiprocessing/pool.py", line 748, in next
    raise value
AttributeError: 'list' object has no attribute 'nodes_of_class'

Expected behavior

This completed successfully on pylint 2.4.4

pylint --version output

pylint 2.5.2
astroid 2.4.1
Python 3.7.6 (default, Mar 11 2020, 08:11:45)
[Clang 11.0.0 (clang-1100.0.33.17)]
natekupp pushed a commit to dagster-io/dagster that referenced this issue May 27, 2020
Summary:
More recent pylint checks more stuff, and specifically it doesn't seem to understand `six.with_metaclass(ABCMeta)` so we need to disable those checks for now.

I don't move pylint to 2.5.2 until D3109, because of pylint-dev/pylint#3648 - the long list of args to pylint seems to trigger a newly-introduced pylint bug in 2.5.x; the refactor in D3109 means we no longer trigger that bug.

Test Plan: buildkite

Reviewers: alangenfeld, sandyryza, max

Reviewed By: sandyryza

Subscribers: schrockn

Differential Revision: https://dagster.phacility.com/D3114
@natekupp
Copy link
Author

natekupp commented May 27, 2020

Update: I've narrowed it down to this line:

https://github.com/dagster-io/dagster/blob/master/python_modules/libraries/dagster-k8s/dagster_k8s_tests/kind.py#L107

This consistently reproduces the above error message. Minimal repro is:

from kubernetes.client.models.v1_container_image import V1ContainerImage

def names(self, names):
    self._names = names  # pylint: disable=protected-access

V1ContainerImage.names = V1ContainerImage.names.setter(names)  # pylint: disable=no-member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🪲 Crash 💥 A bug that makes pylint crash
Projects
None yet
Development

No branches or pull requests

2 participants