-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
C: used-before-assignmentIssues related to 'used-before-assignment' checkIssues related to 'used-before-assignment' checkFalse Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codeNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementationpython 3.12typing
Milestone
Description
Bug description
type IntOrX = int | X
class X:
pass
Configuration
No response
Command used
pylint --py-version=3.12 asdf.py
Pylint output
asdf.py:1:20: E0601: Using variable 'X' before assignment (used-before-assignment)
Expected behavior
No warning
The value of the type alias is evaluated in the annotation scope. It is not evaluated when the type alias is created, but only when the value is accessed through the type alias’s value attribute (see Lazy evaluation). This allows the type alias to refer to names that are not yet defined.
https://docs.python.org/3/reference/simple_stmts.html#the-type-statement
Pylint version
pylint 3.3.0-dev0
astroid 3.3.0-dev0
Python 3.12.3
OS / Environment
No response
Additional dependencies
No response
Metadata
Metadata
Assignees
Labels
C: used-before-assignmentIssues related to 'used-before-assignment' checkIssues related to 'used-before-assignment' checkFalse Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codeNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementationpython 3.12typing