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

[BUG] pylint 2.15.7 crashes #529

Closed
bessman opened this issue Nov 29, 2022 · 1 comment · Fixed by #530
Closed

[BUG] pylint 2.15.7 crashes #529

bessman opened this issue Nov 29, 2022 · 1 comment · Fixed by #530

Comments

@bessman
Copy link
Contributor

bessman commented Nov 29, 2022

Describe the bug
Recently (as in, a few hours ago) my CI builds started failing. The failure is caused by pylint crashing, and coincides with the release of pylint 2.15.7. Running pylint on its own works as expected; the problem only appears when it is run by prospector:

  prospector installdeps: prospector, mypy, bandit
  prospector inst: /home/runner/work/pytest-reserial/pytest-reserial/.tox/.tmp/package/1/pytest-reserial-0.2.2.tar.gz
  prospector installed: astroid==2.12.13,attrs==22.1.0,bandit==1.7.4,dill==0.3.6,dodgy==0.2.1,flake8==4.0.1,flake8-polyfill==1.0.2,gitdb==4.0.10,GitPython==3.1.29,iniconfig==1.1.1,isort==5.10.1,lazy-object-proxy==1.8.0,mccabe==0.6.1,mypy==0.991,mypy-extensions==0.4.3,packaging==21.3,pbr==5.11.0,pep8-naming==0.10.0,platformdirs==2.5.4,pluggy==1.0.0,prospector==1.7.7,pycodestyle==2.8.0,pydocstyle==6.1.1,pyflakes==2.4.0,pylint==2.15.7,pylint-celery==0.3,pylint-django==2.5.3,pylint-flask==0.6,pylint-plugin-utils==0.7,pyparsing==3.0.9,pyserial==3.5,pytest==7.2.0,pytest-reserial @ file:///home/runner/work/pytest-reserial/pytest-reserial/.tox/.tmp/package/1/pytest-reserial-0.2.2.tar.gz,PyYAML==6.0,requirements-detector==0.7,setoptconf-tmp==0.3.1,smmap==5.0.0,snowballstemmer==2.2.0,stevedore==4.1.1,toml==0.10.2,tomlkit==0.11.6,typing_extensions==4.4.0,wrapt==1.14.1
  prospector run-test-pre: PYTHONHASHSEED='3298070011'
  prospector run-test: commands[0] | prospector -X .
  Traceback (most recent call last):
    File "/home/runner/work/pytest-reserial/pytest-reserial/.tox/prospector/lib/python3.11/site-packages/prospector/run.py", line 94, in execute
      messages += tool.run(found_files)
                  ^^^^^^^^^^^^^^^^^^^^^
    File "/home/runner/work/pytest-reserial/pytest-reserial/.tox/prospector/lib/python3.11/site-packages/prospector/tools/pylint/__init__.py", line 253, in run
      self._linter.check(self._args)
    File "/home/runner/work/pytest-reserial/pytest-reserial/.tox/prospector/lib/python3.11/site-packages/pylint/lint/pylinter.py", line 696, in check
      ast_per_fileitem = self._get_asts(fileitems, data)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/runner/work/pytest-reserial/pytest-reserial/.tox/prospector/lib/python3.11/site-packages/pylint/lint/pylinter.py", line 707, in _get_asts
      for fileitem in fileitems:
    File "/home/runner/work/pytest-reserial/pytest-reserial/.tox/prospector/lib/python3.11/site-packages/pylint/lint/pylinter.py", line 874, in _iterate_file_descrs
      for descr in self._expand_files(files_or_modules).values():
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/runner/work/pytest-reserial/pytest-reserial/.tox/prospector/lib/python3.11/site-packages/prospector/tools/pylint/linter.py", line 24, in _expand_files
      if self._files.check_module(module["path"]):
                                  ~~~~~~^^^^^^^^
  TypeError: string indices must be integers, not 'str'
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "/home/runner/work/pytest-reserial/pytest-reserial/.tox/prospector/bin/prospector", line 8, in <module>
      sys.exit(main())
               ^^^^^^
    File "/home/runner/work/pytest-reserial/pytest-reserial/.tox/prospector/lib/python3.11/site-packages/prospector/run.py", line 202, in main
      prospector.execute()
    File "/home/runner/work/pytest-reserial/pytest-reserial/.tox/prospector/lib/python3.11/site-packages/prospector/run.py", line 112, in execute
      raise FatalProspectorException from ex
  TypeError: FatalProspectorException.__init__() missing 1 required positional argument: 'message'
  Error: ERROR: InvocationError for command /home/runner/work/pytest-reserial/pytest-reserial/.tox/prospector/bin/prospector -X . (exited with code 1)

To Reproduce
Run prospector w. pylint enabled.

Environment (please complete the following information):

  • OS: Ubuntu latest
  • Tool: pylint
  • Prospector version: 1.7.7
  • Python version 3.11.0
@bessman bessman changed the title [BUG] pylint 2.15.7 crashes under python3.11 [BUG] pylint 2.15.7 crashes Nov 29, 2022
@bessman
Copy link
Contributor Author

bessman commented Nov 29, 2022

My bad, the error also occurs in earlier versions of python; the CI was using cached versions of pylint for python3.10 and earlier for some reason.

The issue seems to be caused by pylint-dev/pylint@7b82cc8, wherein PyLinter._expand_files was changed to return dict[str, ModuleDescriptionDict] instead of list[ModuleDescriptionDict].

bessman added a commit to bessman/mcbootflash that referenced this issue Nov 30, 2022
bessman added a commit to bessman/pytest-reserial that referenced this issue Nov 30, 2022
bessman added a commit to bessman/pytest-reserial that referenced this issue Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant