-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed as not planned
Closed as not planned
Copy link
Labels
InvalidNot a bug, already exists or already fixedNot a bug, already exists or already fixedpython 3.12
Description
Current problem
I am using Python 3.12 generics new syntax PEP-695 in a project, such as:
def get_users[I](skip: int | None, limit: int | None, inventory: I) -> list[User]:
return repo_handler.get_users(skip, limit, inventory)
Unfortunately, pylint cannot parse it and the following error occurs:
repository.py:18:8: E0001: Parsing failed: 'invalid syntax (<unknown>, line 18)' (syntax-error)
I even tried with the basic syntax:
def head[T](args: Iterable[T]) -> T:
return args[0]
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
issues
For 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
Metadata
Metadata
Assignees
Labels
InvalidNot a bug, already exists or already fixedNot a bug, already exists or already fixedpython 3.12