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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Fix support for UnionType with Python 3.11 #676

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

standag
Copy link

@standag standag commented Oct 3, 2023

Resolves #533

@thomasaarholt
Copy link

This worked like a charm! Thank you!

@adam-moss
Copy link

This is a very nice addition 馃憤

@coreegor
Copy link

Hello everyone,
Is there any plan on having this merged ?
@standag can you set an assignee ?

@standag
Copy link
Author

standag commented Oct 16, 2023

Sorry, I cannot, I haven't write access to this repository.

@peidrao
Copy link

peidrao commented Oct 18, 2023

The PR seems wonderful, why hasn't it been added yet?

@coreegor
Copy link

@standag So you can't set @tiangolo as the assignee ?

@standag
Copy link
Author

standag commented Oct 26, 2023

Who can use this feature
Anyone with write access to a repository can assign issues and pull requests.
https://docs.github.com/en/issues/tracking-your-work-with-issues/assigning-issues-and-pull-requests-to-other-github-users

@disrupted
Copy link

also resolves #348

@aronbierbaum
Copy link

Are there any updates on this pull request. Would love to not need to use Optional or Union.

@johnthagen johnthagen mentioned this pull request Jan 16, 2024
7 tasks
@tino
Copy link

tino commented Jan 26, 2024

@disrupted is @tiangolo the only one that can merge? Seems a bit wasteful that this is sitting here with 2 approves and a passing CI just waiting.

@disrupted
Copy link

@disrupted is @tiangolo the only one that can merge? Seems a bit wasteful that this is sitting here with 2 approves and a passing CI just waiting.

Looks like it. My review only has symbolic value as I am not a maintainer.

@svlandeg
Copy link
Collaborator

Related PR: #548

@sebastian-correa
Copy link

Will this be merged anytime soon? @tiangolo

This has become a sore point with Typer in our code.

@svlandeg svlandeg added bug Something isn't working and removed p3 labels Apr 11, 2024
@svlandeg svlandeg added p2 and removed feature New feature, enhancement or request labels Apr 11, 2024
@svlandeg svlandeg changed the title fix: add support for UnionType annotation 馃悰 Fix support for UnionType with Python 3.11 Apr 11, 2024
Copy link
Collaborator

@svlandeg svlandeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirmed that this behaviour works in 3.10 but broke in 3.11, and the unit test introduced in this PR captures the bug nicely.

The fix is very clean and minimal, using the variables from _typing that were introduced precisely for this type of usage.

Thanks for the contribution @standag!

@svlandeg
Copy link
Collaborator

svlandeg commented Apr 11, 2024

Update: #548 now contains all the changes that are also in this PR, as well as a few additional rewrites. As such, I recommend to merge #548 and close this one, but I'll leave the final decision with Tiangolo.

@svlandeg svlandeg linked an issue Apr 11, 2024 that may be closed by this pull request
7 tasks
@svlandeg svlandeg linked an issue Apr 11, 2024 that may be closed by this pull request
7 tasks
@johnthagen johnthagen mentioned this pull request May 2, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working p2 types Type hints and type checking
Projects
None yet
10 participants