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

PEP 695: infer generic bases #2370

Open
jacobtylerwalls opened this issue Feb 3, 2024 · 0 comments
Open

PEP 695: infer generic bases #2370

jacobtylerwalls opened this issue Feb 3, 2024 · 0 comments
Labels
inference Needs PR This issue is accepted, sufficiently specified and now needs an implementation python 3.12

Comments

@jacobtylerwalls
Copy link
Member

jacobtylerwalls commented Feb 3, 2024

Steps to reproduce

From test_mro_generic_3():

from astroid import extract_node

node = extract_node("""
from typing import Generic, TypeVar
T = TypeVar('T')
class A: ...
class B(A, Generic[T]): ...
class C(Generic[T]): ...
class D(B[T], C[T], Generic[T]): ...
""")

list(node._inferred_bases())

Current behavior

3.11

[<ClassDef.B l.5 at 0x10472a250>, <ClassDef.C l.6 at 0x104729650>, <ClassDef.Generic l.1788 at 0x104bfe650>]

3.12 with main branch of astroid

[<ClassDef.B l.5 at 0x104531d90>, <ClassDef.C l.6 at 0x104531ee0>, <ClassDef.Generic l.2 at 0x104f71130>]

3.12 with removing register_module_extender(manager, "typing", _typing_transform), which we would like to be able to do (see pylint-dev/pylint#9401 (comment)):

[]

I believe the inference is failing on those bases.

Expected behavior

Better solution for preserving 3.11 behavior than the _typing_transform, which stubs out the typing module very minimally (see f2120db)

@jacobtylerwalls jacobtylerwalls added python 3.12 inference Needs PR This issue is accepted, sufficiently specified and now needs an implementation labels Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inference Needs PR This issue is accepted, sufficiently specified and now needs an implementation python 3.12
Projects
None yet
Development

No branches or pull requests

1 participant