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

typing_inspect.get_args Annotated metadata args #82

Open
anders-kiaer opened this issue Oct 20, 2021 · 1 comment
Open

typing_inspect.get_args Annotated metadata args #82

anders-kiaer opened this issue Oct 20, 2021 · 1 comment

Comments

@anders-kiaer
Copy link

Is typing_inspect.get_args expected to also return metadata args for Annotated?

Python 3.9.5:

>>> import typing
>>>
>>> A = typing.Annotated[int, "some_metadata"]
>>>
>>> typing.get_args(A)
(<class 'int'>, 'some_metadata')

Python 3.8.6:

>>> import typing_extensions  # 3.10.0.2
>>> import typing_inspect  # 0.7.1
>>> 
>>> A = typing_extensions.Annotated[int, "some_metadata"]
>>>
>>> typing_inspect.get_args(A)
(<class 'int'>,)
@ilevkivskyi
Copy link
Owner

I think it should only return the actual type argument (i.e. (int,) in this case). Also IIUC it used to work in 3.8 by accident, please feel free to submit a PR fixing this (probably by introducing some dedicated support for Annotated)

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

2 participants