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

Add support for Python 3.12's type aliases #606

Merged
merged 1 commit into from
Dec 8, 2023
Merged

Add support for Python 3.12's type aliases #606

merged 1 commit into from
Dec 8, 2023

Commits on Dec 8, 2023

  1. Add support for Python 3.12's type aliases

    This adds support for the new syntactic type aliases added in Python
    3.12. A few examples:
    
    ```
    type NullableStr = str | None
    
    type Pair[T] = tuple[T, T]
    
    type NullableStrPair = Pair[NullableStr]
    ```
    
    msgspec now supports these type aliases, *except* in cases where the
    type alias is recursive. For example, the following type isn't
    supported:
    
    ```
    type Link[T] = tuple[T, Link[T] | None]
    ```
    
    The internal datastructure we use to store type information was not
    designed to handle recursive types like these; supporting them will
    require a larger refactor.
    jcrist committed Dec 8, 2023
    Configuration menu
    Copy the full SHA
    f95e42b View commit details
    Browse the repository at this point in the history