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 complains about unsubscriptable-object under Python ≥3.9 #9092

Open
gilles-peskine-arm opened this issue May 2, 2024 · 0 comments · May be fixed by #9101
Open

pylint complains about unsubscriptable-object under Python ≥3.9 #9092

gilles-peskine-arm opened this issue May 2, 2024 · 0 comments · May be fixed by #9101
Labels
component-test Test framework and CI scripts enhancement

Comments

@gilles-peskine-arm
Copy link
Contributor

In scripts/ci.requirements.txt, we impose a specific version of Pylint, because newer versions are likely to add additional checks that fail on our code. Unfortunately, newer versions of Python can also cause failures even with the same version of Pylint. Specifically, it looks like Pylint under Python ≥3.9 becomes somewhat type-aware, and complains about subscripting Optional[something_subscriptable].

python -m venv venv-3.9
. venv-3.9/bin/activate
scripts/min_requirements.py
tests/scripts/check-python-files.sh

results in many errors of the form

************* Module mbedtls_dev.build_tree
scripts/mbedtls_dev/build_tree.py:25:32: E1136: Value 'Optional' is unsubscriptable (unsubscriptable-object)
…

These are all very likely to be false positives since mypy, which has a smarter type checker, is happy.

The same version of Pylint under Python ≤3.8 is happy.

The solution for this specific problem is probably to disable unsubscriptable-object in .pylintrc. Let mypy do that job since it does it better.

@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 linked a pull request May 6, 2024 that will close this issue
5 tasks
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

Successfully merging a pull request may close this issue.

1 participant