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

Old pylint versions crash on some of our scripts with modern Python #9091

Open
gilles-peskine-arm opened this issue May 2, 2024 · 0 comments
Labels
component-test Test framework and CI scripts enhancement

Comments

@gilles-peskine-arm
Copy link
Contributor

gilles-peskine-arm commented May 2, 2024

Our official pylint version (2.4.4 per ci.reqiurements.txt) chokes on tests/scripts/translate_ciphers.py when run under Python 3.9–3.11. Python ≤3.8 is fine.

$ venv-run venv-3.9 pylint tests/scripts/translate_ciphers.py
Traceback (most recent call last):
  File "/home/gilpes01/z/dev/mbedtls/main/venv-3.9/bin/pylint", line 8, in <module>
    sys.exit(run_pylint())
  File "/home/gilpes01/z/dev/mbedtls/main/venv-3.9/lib/python3.9/site-packages/pylint/__init__.py", line 23, in run_pylint
    PylintRun(sys.argv[1:])
  File "/home/gilpes01/z/dev/mbedtls/main/venv-3.9/lib/python3.9/site-packages/pylint/lint.py", line 1731, in __init__
    linter.check(args)
  File "/home/gilpes01/z/dev/mbedtls/main/venv-3.9/lib/python3.9/site-packages/pylint/lint.py", line 1004, in check
    self._do_check(files_or_modules)
  File "/home/gilpes01/z/dev/mbedtls/main/venv-3.9/lib/python3.9/site-packages/pylint/lint.py", line 1165, in _do_check
    self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
  File "/home/gilpes01/z/dev/mbedtls/main/venv-3.9/lib/python3.9/site-packages/pylint/lint.py", line 1252, in check_astroid_module
    walker.walk(ast_node)
  File "/home/gilpes01/z/dev/mbedtls/main/venv-3.9/lib/python3.9/site-packages/pylint/utils/ast_walker.py", line 77, in walk
    self.walk(child)
  File "/home/gilpes01/z/dev/mbedtls/main/venv-3.9/lib/python3.9/site-packages/pylint/utils/ast_walker.py", line 77, in walk
    self.walk(child)
  File "/home/gilpes01/z/dev/mbedtls/main/venv-3.9/lib/python3.9/site-packages/pylint/utils/ast_walker.py", line 77, in walk
    self.walk(child)
  File "/home/gilpes01/z/dev/mbedtls/main/venv-3.9/lib/python3.9/site-packages/pylint/utils/ast_walker.py", line 74, in walk
    callback(astroid)
  File "/home/gilpes01/z/dev/mbedtls/main/venv-3.9/lib/python3.9/site-packages/pylint/checkers/typecheck.py", line 1598, in visit_subscript
    inferred = safe_infer(node.slice.value)
AttributeError: 'Name' object has no attribute 'value'

Python 3.12 is even worse: pylint 2.4.4 doesn't work at all.

$ venv-run venv-3.12 pip install pylint==2.4.4
…
$ venv-run venv-3.12 pylint --version
Traceback (most recent call last):
  File "/home/gilpes01/z/dev/mbedtls/main/venv-3.12/bin/pylint", line 5, in <module>
    from pylint import run_pylint
  File "/home/gilpes01/z/dev/mbedtls/main/venv-3.12/lib/python3.12/site-packages/pylint/__init__.py", line 13, in <module>
    from pylint.checkers.similar import Run as SimilarRun
  File "/home/gilpes01/z/dev/mbedtls/main/venv-3.12/lib/python3.12/site-packages/pylint/checkers/__init__.py", line 42, in <module>
    from pylint.checkers.base_checker import BaseChecker, BaseTokenChecker
  File "/home/gilpes01/z/dev/mbedtls/main/venv-3.12/lib/python3.12/site-packages/pylint/checkers/base_checker.py", line 17, in <module>
    from pylint.config import OptionsProviderMixIn
  File "/home/gilpes01/z/dev/mbedtls/main/venv-3.12/lib/python3.12/site-packages/pylint/config.py", line 49, in <module>
    from pylint import utils
  File "/home/gilpes01/z/dev/mbedtls/main/venv-3.12/lib/python3.12/site-packages/pylint/utils/__init__.py", line 44, in <module>
    from pylint.utils.ast_walker import ASTWalker
  File "/home/gilpes01/z/dev/mbedtls/main/venv-3.12/lib/python3.12/site-packages/pylint/utils/ast_walker.py", line 8, in <module>
    from astroid import nodes
  File "/home/gilpes01/z/dev/mbedtls/main/venv-3.12/lib/python3.12/site-packages/astroid/__init__.py", line 43, in <module>
    import wrapt
  File "/home/gilpes01/z/dev/mbedtls/main/venv-3.12/lib/python3.12/site-packages/wrapt/__init__.py", line 10, in <module>
    from .decorators import (adapter_factory, AdapterFactory, decorator,
  File "/home/gilpes01/z/dev/mbedtls/main/venv-3.12/lib/python3.12/site-packages/wrapt/decorators.py", line 34, in <module>
    from inspect import ismethod, isclass, formatargspec
ImportError: cannot import name 'formatargspec' from 'inspect' (/usr/lib/python3.12/inspect.py). Did you mean: 'formatargvalues'?

Pylint 2.6.2, which is the last version that supports Python 3.5), works on tests/scripts/translate_ciphers.py, but under Python 3.11 it crashes with a different exception on several files:

scripts/abi_check.py
scripts/generate_driver_wrappers.py
tests/scripts/analyze_outcomes.py
tests/scripts/check_names.py
tests/scripts/depends.py
@gilles-peskine-arm gilles-peskine-arm added enhancement component-test Test framework and CI scripts labels May 2, 2024
@gilles-peskine-arm gilles-peskine-arm changed the title pylint 2.4.4 crashes on tests/scripts/translate_ciphers.py with modern Python Old pylint versions crash on some of our scripts with modern Python May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component-test Test framework and CI scripts enhancement
Projects
Status: No status
Development

No branches or pull requests

1 participant