8000 `TypeVar` substitution does not work correctly with `TypeAliasType` · Issue #6158 · pydantic/pydantic · GitHub
[go: up one dir, main page]

Skip to content
TypeVar substitution does not work correctly with TypeAliasType #6158
@adriangb

Description

@adriangb
from typing import List, TypeVar

from typing_extensions import TypeAliasType

from pydantic.type_adapter import TypeAdapter

T = TypeVar('T')  # or a bound=SupportGt

PositiveList = TypeAliasType('PositiveList', List[T])

ta = TypeAdapter(PositiveList[float])

v = ta.validate_python(['1'])
print(v)
#> ['1']

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0