The Wayback Machine - https://web.archive.org/web/20211027194122/https://github.com/python/cpython/pull/27841
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

bpo-44524: Don't modify MRO when inheriting from typing.Annotated #27841

Merged
merged 5 commits into from Aug 25, 2021

Conversation

@Fidget-Spinner
Copy link
Contributor

@Fidget-Spinner Fidget-Spinner commented Aug 19, 2021

https://bugs.python.org/issue44524

Lib/typing.py Show resolved Hide resolved
@Fidget-Spinner
Copy link
Contributor Author

@Fidget-Spinner Fidget-Spinner commented Aug 21, 2021

Wait don't merge yet, I need to update some things.

@Fidget-Spinner Fidget-Spinner marked this pull request as draft Aug 21, 2021
@Fidget-Spinner
Copy link
Contributor Author

@Fidget-Spinner Fidget-Spinner commented Aug 21, 2021

Interestingly, Annotated[Any, 'foo'].__name__ now returns Any, because it sets origin to Any.

This behavior is quite opinionated, but is consistent with how get_type_hints treats Annotated (it strips the Annotated information and just gives the contained type). Nonetheless, I have made it return 'Annotated'.

@Fidget-Spinner Fidget-Spinner marked this pull request as ready for review Aug 21, 2021
@Fidget-Spinner Fidget-Spinner changed the title bpo-44524: Temporarily exclude _name from typing.Annotated bpo-44524: Don't modify MRO when inheriting from typing.Annotated Aug 21, 2021
@serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Aug 25, 2021

Merge?

@Fidget-Spinner
Copy link
Contributor Author

@Fidget-Spinner Fidget-Spinner commented Aug 25, 2021

Merge?

Please do. I don't have permissions to merge this myself.

@serhiy-storchaka serhiy-storchaka merged commit 23384a1 into python:main Aug 25, 2021
11 checks passed
@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Aug 25, 2021

Thanks @Fidget-Spinner for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒🤖

@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Aug 25, 2021

GH-27950 is a backport of this pull request to the 3.10 branch.

miss-islington added a commit to miss-islington/cpython that referenced this issue Aug 25, 2021
miss-islington added a commit that referenced this issue Aug 25, 2021
@Fidget-Spinner Fidget-Spinner deleted the name_annotated branch Aug 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants