Skip to content

Annotated/get_type_hints interaction in python <3.11 #310

Description

@DanCardin

I'm not sure if you're aiming for exact compatibility among python versions for all of the functions you support or not.

But due to python/cpython#90353, get_type_hints with include_extras=True has inconsistent behavior among python versions below 3.11.

  • def foo(bar: Annotated[Union[int, None]]) -> Annotated[Union[int, None]]
  • def foo(bar: Annotated[Union[int, None]] = None) -> Optional[Annotated[Union[int, None]]]

I see #94, which mentions not wanting to do more rigorous porting due to it cascading into more code needing to be pulled in, so I'm not sure what the reaction to this will be...

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions