-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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.get_type_hints documentation claims it no longer includes base class type hints. #100673
Comments
Thanks for catching, that sounds right to me. Want to open a PR to remove it? E.g. easy to confirm that the following extension of the test added in that PR has the same class A:
attr: int
class B(A):
pass
class C(A):
attr: str
class D:
attr2: int
class E(A, D):
pass
class F(C, A):
pass
print(A.__annotations__)
print(B.__annotations__)
print(C.__annotations__)
print(D.__annotations__)
print(E.__annotations__)
print(F.__annotations__)
print("=" * 40)
import typing
print(typing.get_type_hints(A))
print(typing.get_type_hints(B))
print(typing.get_type_hints(C))
print(typing.get_type_hints(D))
print(typing.get_type_hints(E))
print(typing.get_type_hints(F)) |
Seems straightforward, and I've got a commit I could create a pull request for, but I don't have a dev environment set up to be able to build the docs or run stuff like |
That commit looks good to me. Open the PR and I'll take care of the rest :-) |
Removed erroneous note in the get_type_hints docs typing.get_type_hints still includes base class type hints.
…ythonGH-100701) Removed erroneous note in the get_type_hints docs typing.get_type_hints still includes base class type hints. (cherry picked from commit deaf090) Co-authored-by: FrozenBob <[email protected]>
Removed erroneous note in the get_type_hints docs typing.get_type_hints still includes base class type hints. (cherry picked from commit deaf090) Co-authored-by: FrozenBob <[email protected]>
…ython#100701) Removed erroneous note in the get_type_hints docs typing.get_type_hints still includes base class type hints. (cherry picked from commit deaf090)
Thank you! |
Documentation
The
typing.get_type_hints
documentation currently saysThis is incorrect. No such change was made in 3.10, and no such change should be made. The documentation was changed erroneously when someone mixed up the
typing.get_type_hints
behavior with an unrelated__annotations__
change.This note should be removed from the
typing.get_type_hints
documentation.Linked PRs
The text was updated successfully, but these errors were encountered: