Skip to content

GenericAlias type equality checks with builtin generics are failing  #97543

@art049

Description

@art049

Bug report

This works as expected and as presented in the documentation

from typing import  GenericAlias

assert GenericAlias(tuple, (int, str)) == tuple[int, str]

However, using the legacy typing interface, the equality check fails

from typing import  GenericAlias, Tuple

assert GenericAlias(Tuple, (int, str)) == Tuple[int, str]
#> AssertionError

This also fails (and shouldn't work anyway)

from typing import  GenericAlias, Tuple

assert GenericAlias(Tuple, (int, str)) == tuple[int, str]
#> AssertionError

Your environment

  • CPython versions tested on: Python 3.9.12
  • Operating system and architecture: Manjaro 5.15 x86_64

Metadata

Metadata

Assignees

No one assigned

    Labels

    pendingThe issue will be closed if no feedback is providedtopic-typingtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions