-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Undefined variable T using generic on Class (PEP695) #9335
Labels
C: undefined-variable
Issues related to 'undefined-variable' check
False Positive 🦟
A message is emitted but nothing is wrong with the code
Needs PR
This issue is accepted, sufficiently specified and now needs an implementation
python 3.12
Comments
trentontrees
added
the
Needs triage 📥
Just created, needs acknowledgment, triage, and proper labelling
label
Dec 29, 2023
Thanks for the report. Test case as a diff: diff --git a/tests/functional/u/undefined/undefined_variable_py312.py b/tests/functional/u/undefined/undefined_variable_py312.py
index 0ca2475eb..88a542653 100644
--- a/tests/functional/u/undefined/undefined_variable_py312.py
+++ b/tests/functional/u/undefined/undefined_variable_py312.py
@@ -4,4 +4,5 @@ def f[T](a: T) -> T:
print(a)
class ChildClass[T, *Ts, **P]:
- ...
+ def __init__(self, value: T):
+ self.value = value |
jacobtylerwalls
added
False Positive 🦟
A message is emitted but nothing is wrong with the code
C: undefined-variable
Issues related to 'undefined-variable' check
Needs PR
This issue is accepted, sufficiently specified and now needs an implementation
python 3.12
and removed
Needs triage 📥
Just created, needs acknowledgment, triage, and proper labelling
labels
Dec 30, 2023
I am getting the following error for generics on functions. Unused variable 'T' Pylint(W0612:unused-variable) I am on pylint 3.1.0 |
Same issue here. Pylint Version
OS / Environment
|
Don't know if it's related to this one, but I'm getting the same error with class A[T]:
pass
class B[T](A[T]):
pass It throws
|
Same with the following class: class MyClass[T]:
def func(self, x: T, y: T):
print(x, y) Version info:
|
Same issue with
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C: undefined-variable
Issues related to 'undefined-variable' check
False Positive 🦟
A message is emitted but nothing is wrong with the code
Needs PR
This issue is accepted, sufficiently specified and now needs an implementation
python 3.12
Bug description
Configuration
No response
Command used
Pylint output
Expected behavior
There should be no error E0602 reported.
Pylint version
OS / Environment
OSX - Sonoma 14.1.2 (23B92)
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: