-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Support for PEP 695 - E0001 should not fire on 3.12 generics syntax #9217
Comments
Hi 👋🏻. What python interpreter are you using to run pylint? Below 3.12? |
Hmm yeah, I reproduced on 3.11, but a 3.11 interpreter is supposed to have this result. |
I use the 3.12 interpreter (via pyenv): $ pylint --version
pylint 3.0.2
astroid 3.0.1
Python 3.12.0 (main, Nov 4 2023, 03:02:50) [GCC 11.4.0]
|
Thanks for providing the output of From your first error message, it also seems pylint is being executed on an interpreter on 3.10 or below, because in 3.11 I would expect a more fine-grained error message ( % python3.12 -m pylint b.py
************* Module b
b.py:1:0: C0114: Missing module docstring (missing-module-docstring)
b.py:1:0: C0116: Missing function or method docstring (missing-function-docstring)
b.py:1:76: E0602: Undefined variable 'User' (undefined-variable)
b.py:1:14: C0103: Variable name "I" doesn't conform to snake_case naming style (invalid-name)
b.py:2:11: E0602: Undefined variable 'repo_handler' (undefined-variable)
------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)
% python3.11 -m pylint b.py
************* Module b
b.py:1:14: E0001: Parsing failed: 'expected '(' (<unknown>, line 1)' (syntax-error)
% python3.10 -m pylint b.py
************* Module b
b.py:1:14: E0001: Parsing failed: 'invalid syntax (<unknown>, line 1)' (syntax-error) |
Current problem
I am using Python 3.12 generics new syntax PEP-695 in a project, such as:
Unfortunately, pylint cannot parse it and the following error occurs:
I even tried with the basic syntax:
But the same error occurs
Desired solution
For now, I'd say it should give a more ad-hoc error (rather than
invalid syntax
), so we could at least skip it.Ideally it should handle this new syntax.
Additional context
I didn't find this issue among
pylint
open issues.Though, I found it here in
mypy
issuesFor now, they did a little workaround, saying they cant handle PEP-695 yet,
but it seems that a lot of work needs to be done to handle it.
Unfortunately I'm not sure I have enough free time yet to open a PR and try to fix those issues
The text was updated successfully, but these errors were encountered: