Skip to content
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

False positive on PEP695 generic class syntax #9682

Closed
Microwave-WYB opened this issue May 31, 2024 · 1 comment
Closed

False positive on PEP695 generic class syntax #9682

Microwave-WYB opened this issue May 31, 2024 · 1 comment
Labels
Duplicate 🐫 Duplicate of an already existing issue

Comments

@Microwave-WYB
Copy link

Microwave-WYB commented May 31, 2024

Bug description

class Updatable[T](ABC):
    """A record that can be updated with a new value."""

    @abstractmethod
    def update(self, value: T) -> Self:
        """Update the record with a new value."""

Pylint reports the typevar T in value: T as an undefined variables

This should be a valid generic typing syntax since 3.12

Configuration

[MESSAGES CONTROL]
disable=too-many-arguments,too-few-public-methods,missing-module-docstring,missing-class-docstring,missing-function-docstring

Command used

pylint --rcfile=.pylintrc qcat

Pylint output

************* Module qcat.trading.core
qcat/trading/core.py:38:28: E0602: Undefined variable 'T' (undefined-variable)

------------------------------------------------------------------
Your code has been rated at 9.86/10 (previous run: 8.99/10, +0.87)

Expected behavior

T should be a valid typevar

Pylint version

pylint 3.2.2
astroid 3.2.2
Python 3.12.3 (main, Apr 23 2024, 09:16:07) [GCC 13.2.1 20240417]


### OS / Environment

ArchLinux

### Additional dependencies

_No response_
@Microwave-WYB Microwave-WYB added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label May 31, 2024
@jacobtylerwalls
Copy link
Member

Duplicate of #9335

@jacobtylerwalls jacobtylerwalls marked this as a duplicate of #9335 Jun 1, 2024
@jacobtylerwalls jacobtylerwalls closed this as not planned Won't fix, can't repro, duplicate, stale Jun 1, 2024
@jacobtylerwalls jacobtylerwalls added Duplicate 🐫 Duplicate of an already existing issue and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate 🐫 Duplicate of an already existing issue
Projects
None yet
Development

No branches or pull requests

2 participants