-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
C: used-before-assignmentIssues related to 'used-before-assignment' checkIssues related to 'used-before-assignment' checkpython 3.12
Milestone
Description
Bug description
Python 3.12.0
Possibly sharing the same root cause as #9098 but I'm reporting as the behavior is different just in case (here no crashes, just incorrect results). It'd be great if pylint can support all the type parameters specification described in https://peps.python.org/pep-0695/.
def constrained[T: (str, bytes)](argument: T) -> T:
return argument(EDIT: removed the second example in edit because it's not valid)
Configuration
No pylintrc is used (under the default setting).Command used
pylint 695.py --disable=C0114,C0116
(Note: C0114, C0116 are missing docstrings)Pylint output
************* Module 695
695.py:1:43: E0602: Undefined variable 'T' (undefined-variable)
695.py:1:49: E0602: Undefined variable 'T' (undefined-variable)
695.py:1:16: W0612: Unused variable 'T' (unused-variable)Expected behavior
There should be no E0602, W0612, E0602 warnings and errors. T in the parameter annotation is the generic type.
Pylint version
pylint 3.0.0
astroid 3.0.0
Python 3.12.0 | packaged by conda-forge | (main, Oct 3 2023, 08:36:57) [Clang 15.0.7 ]OS / Environment
macOS and Linux
Additional dependencies
N/Apdcastro
Metadata
Metadata
Assignees
Labels
C: used-before-assignmentIssues related to 'used-before-assignment' checkIssues related to 'used-before-assignment' checkpython 3.12