Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-144190: Clarify get_type_hints() instance behavior in docs#144831

Merged
hugovk merged 1 commit into
python:mainpython/cpython:mainfrom
iamrajhans:gh-144190-get-type-hints-docsiamrajhans/cpython:gh-144190-get-type-hints-docsCopy head branch name to clipboard
Feb 26, 2026
Merged

gh-144190: Clarify get_type_hints() instance behavior in docs#144831
hugovk merged 1 commit into
python:mainpython/cpython:mainfrom
iamrajhans:gh-144190-get-type-hints-docsiamrajhans/cpython:gh-144190-get-type-hints-docsCopy head branch name to clipboard

Conversation

@iamrajhans

@iamrajhans iamrajhans commented Feb 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Document typing.get_type_hints() behavior for instance objects in Python 3.14+.

  • Clarify that get_type_hints() is intended for modules, classes, and callables.
  • Add an explicit note that calling get_type_hints() on instances is not supported.
  • Recommend get_type_hints(type(obj)) for instance use cases.
  • Add a versionchanged:: 3.14 note 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.


📚 Documentation preview 📚: https://cpython-previews--144831.org.readthedocs.build/

@JelleZijlstra JelleZijlstra added the needs backport to 3.14 bugs and security fixes label Feb 15, 2026
@hugovk hugovk merged commit e234662 into python:main Feb 26, 2026
42 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Feb 26, 2026
@miss-islington-app

Copy link
Copy Markdown

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 request Feb 26, 2026
…ythonGH-144831)

(cherry picked from commit e234662)

Co-authored-by: Rajhans Jadhao <rajhans.jadhao@gmail.com>
@bedevere-app

bedevere-app Bot commented Feb 26, 2026

Copy link
Copy Markdown

GH-145258 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Feb 26, 2026
hugovk pushed a commit that referenced this pull request Feb 26, 2026
…H-144831) (#145258)

Co-authored-by: Rajhans Jadhao <rajhans.jadhao@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.