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

TypedDict support breaks using postponed evaluation of annotations #4

Closed
sg495 opened this issue Jan 6, 2024 · 0 comments
Closed

Comments

@sg495
Copy link
Contributor

sg495 commented Jan 6, 2024

Using postponed evaluation of annotations from PEP-563 breaks TypedDict support introduced in v1.2.0:

>>> from __future__ import annotations
>>> from typing import TypedDict
>>> class MyDict(TypedDict):
>>>     x: int
>>> validate({"x": 2}, MyDict)
ValueError: Type alias 'int' is not known. Perhaps set it with validation_aliases(int=...)?

The issues is a direct access to t.__annotations__ in _validate_typed_dict, which use get_type_hints(t) instead.

@sg495 sg495 closed this as completed in c9177be Jan 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant