GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-144190: Clarify get_type_hints() instance behavior in docs by iamrajhans · Pull Request #144831 · python/cpython

Conversation

@iamrajhans

@iamrajhans iamrajhans commented Feb 15, 2026 •
edited by github-actions Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

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.

  • Issue: get_type_hints fails for dataclass in 3.14 #144190

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@iamrajhans
pythongh-144190: Clarify get_type_hints() instance behavior in docs
1636cce
@iamrajhans
iamrajhans requested review from AlexWaygood and JelleZijlstra as code owners February 15, 2026 09:05
@bedevere-app bedevere-app Bot added awaiting review docs Documentation in the Doc dir skip news labels Feb 15, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Feb 15, 2026
get_type_hints fails for dataclass in 3.14 #144190
Closed
@github-project-automation github-project-automation Bot added this to Docs PRs Feb 15, 2026
@github-project-automation github-project-automation Bot moved this to Todo in Docs PRs Feb 15, 2026
JelleZijlstra
JelleZijlstra approved these changes Feb 15, 2026
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Feb 15, 2026
@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

Uh oh!

There was an error while loading. Please reload this page.

@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Feb 26, 2026
@miss-islington-app

miss-islington-app Bot commented Feb 26, 2026

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.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Feb 26, 2026
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 26, 2026
@iamrajhans @miss-islington
pythongh-144190: Clarify get_type_hints() instance behavior in docs (p…
f0a0e33
…ythonGH-144831)

(cherry picked from commit e234662)

Co-authored-by: Rajhans Jadhao <[email protected]>
@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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@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
@miss-islington @iamrajhans
[3.14] gh-144190: Clarify get_type_hints() instance behavior in docs (G…
856fdc6
…H-144831) (#145258)

Co-authored-by: Rajhans Jadhao <[email protected]>
brijkapadia pushed a commit to brijkapadia/cpython that referenced this pull request Feb 28, 2026
@iamrajhans @brijkapadia
pythongh-144190: Clarify get_type_hints() instance behavior in docs (p…
9577f19
…ython#144831)
ljfp pushed a commit to ljfp/cpython that referenced this pull request Apr 25, 2026
@iamrajhans @ljfp
pythongh-144190: Clarify get_type_hints() instance behavior in docs (p…
70e16e4
…ython#144831)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@JelleZijlstra JelleZijlstra JelleZijlstra approved these changes
@AlexWaygood AlexWaygood Awaiting requested review from AlexWaygood AlexWaygood is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

docs Documentation in the Doc dir skip news

Projects

Docs PRs
Status: Done

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@iamrajhans @JelleZijlstra @hugovk
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.