Issue with specialization of aliases · Issue #444 · google/pytype · GitHub
Skip to content
This repository was archived by the owner on Sep 3, 2026. It is now read-only.
This repository was archived by the owner on Sep 3, 2026. It is now read-only.

Issue with specialization of aliases #444

Description

@CraftSpider

The following example results in the bug AttributeError: 'UnionType' object has no attribute 'name' when run through pytd. This is from most recent pytype from pip

from typing import Union, IO, AnyStr
from typing_extensions import Literal

_Data = Union[IO[AnyStr]]

def func(param: _Data[str]) -> None: ...

This is a minimal case that doesn't use the TypeVar nature of _Data, but for example it could be declared as (param: _Data[AnyStr]) -> AnyStr, which at the very least shouldn't error, even if the types aren't fully inferred.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions