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 some comments for Union types [part 2b] #12281

Merged

Conversation

picnixz
Copy link
Member

@picnixz picnixz commented Apr 15, 2024

Union types were incorrectly rendered when None is not the type in the list. Literal Nones are kept as is since they are semantically different (at least for me).

Nevertheless, PEP 585 generics retain their ordering since this is also the case natively (i.e., None | int is rendered as None | int).

This is built upon #12280.

@picnixz
Copy link
Member Author

picnixz commented Apr 15, 2024

@AA-Turner Ah, I see what you did. Actually, I'd prefer keeping Union as Union because people might want to render them as such. Or do you think it's preferrable to just use PEP 585 for everything?

…yping-union-bugfix

# Conflicts:
#	sphinx/util/typing.py
#	tests/test_util/test_util_typing.py
@picnixz picnixz changed the title Fix rendering of union types [part 2b] add some comments for Union types [part 2b] Apr 15, 2024
@picnixz
Copy link
Member Author

picnixz commented Apr 15, 2024

I'll go with your changes, so either we push this one just after #12280 just to add some comments for the future or we can skip this PR.

@AA-Turner AA-Turner enabled auto-merge (squash) April 22, 2024 22:26
@AA-Turner AA-Turner merged commit a5f534a into sphinx-doc:master Apr 22, 2024
20 of 23 checks passed
@picnixz picnixz deleted the cleanup/util-2b-typing-union-bugfix branch April 23, 2024 10:21
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 24, 2024
@AA-Turner AA-Turner added this to the 7.4.0 milestone Jul 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants