Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34.2k
gh-144190: Clarify get_type_hints() instance behavior in docs#144831
Merged
hugovk merged 1 commit intopython:mainfromFeb 26, 2026
Merged
gh-144190: Clarify get_type_hints() instance behavior in docs#144831hugovk merged 1 commit intopython:mainfrom
hugovk merged 1 commit intopython:mainfrom
Conversation
JelleZijlstra approved these changesFeb 15, 2026
e234662 intopython:main 42 checks passed
Uh oh!
There was an error while loading.Please reload this page.
Thanks@iamrajhans for the PR, and@hugovk for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestFeb 26, 2026
…ythonGH-144831)(cherry picked from commite234662)Co-authored-by: Rajhans Jadhao <rajhans.jadhao@gmail.com>
GH-145258 is a backport of this pull request to the3.14 branch. |
hugovk pushed a commit that referenced this pull requestFeb 26, 2026
bkap123 pushed a commit to bkap123/cpython that referenced this pull requestFeb 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading.Please reload this page.
Summary
Document
typing.get_type_hints()behavior for instance objects in Python 3.14+.get_type_hints()is intended for modules, classes, and callables.get_type_hints()on instances is not supported.get_type_hints(type(obj))for instance use cases.versionchanged:: 3.14note explaining that instance support in earlier versions was undocumented behavior.Why
Issue#144190 reported a regression when calling
get_type_hints(self)in a dataclass__init__.Core-dev discussion confirmed this is intentional in 3.14 and should be documented.
Testing
Docs-only change; no runtime behavior changed.
get_type_hintsfails fordataclassin 3.14 #144190📚 Documentation preview 📚:https://cpython-previews--144831.org.readthedocs.build/