Title: Backport support for get_type_hints on lone stringified ClassVar · Issue #643 · python/typing_extensions · GitHub
Open Graph Title: Backport support for get_type_hints on lone stringified ClassVar · Issue #643 · python/typing_extensions
X Title: Backport support for get_type_hints on lone stringified ClassVar · Issue #643 · python/typing_extensions
Description: Currently, both typing.get_type_hints and typing_extensions.get_type_hints fail on a lone stringified ClassVar annotation in Python 3.9 and 3.10: from __future__ import annotations from typing import ClassVar, get_type_hints as get_type_...
Open Graph Description: Currently, both typing.get_type_hints and typing_extensions.get_type_hints fail on a lone stringified ClassVar annotation in Python 3.9 and 3.10: from __future__ import annotations from typing impo...
X Description: Currently, both typing.get_type_hints and typing_extensions.get_type_hints fail on a lone stringified ClassVar annotation in Python 3.9 and 3.10: from __future__ import annotations from typing impo...
Opengraph URL: https://github.com/python/typing_extensions/issues/643
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Backport support for get_type_hints on lone stringified ClassVar","articleBody":"Currently, both `typing.get_type_hints` and `typing_extensions.get_type_hints` fail on a lone stringified `ClassVar` annotation in Python 3.9 and 3.10:\n\n```python\nfrom __future__ import annotations\n\nfrom typing import ClassVar, get_type_hints as get_type_hints\nfrom typing_extensions import get_type_hints as get_type_hints_ext\n\n\nclass Foo:\n MY_CLASS_CONSTANT: ClassVar = 5\n\n\ntry:\n _ = get_type_hints(Foo)\nexcept TypeError as exc:\n print(exc)\n\ntry:\n _ = get_type_hints_ext(Foo)\nexcept TypeError as exc:\n print(exc)\n```\n\nThis is unfortunate, as https://github.com/python/cpython/issues/90711 addressed this for Python 3.11+, so it would be nice if `typing-extensions` backported this fix for older python versions.","author":{"url":"https://github.com/ItsDrike","@type":"Person","name":"ItsDrike"},"datePublished":"2025-08-10T17:54:08.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/643/typing_extensions/issues/643"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:493aa7c9-03e2-3428-f696-a16a6e504bd0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BBCA:1DC4AD:33CED43:4576F2A:696F2858 |
| html-safe-nonce | 5b52415bff805e2636b02c2f1b9a0817bd0a71f53dcca8cadcf93c755cfa5801 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQkNBOjFEQzRBRDozM0NFRDQzOjQ1NzZGMkE6Njk2RjI4NTgiLCJ2aXNpdG9yX2lkIjoiNDg4OTg1Nzk3ODA3Nzc1MTM4NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2648f270cbb267d2694051d00c356ff540aadc63ef8818c6bb863943ad9706f7 |
| hovercard-subject-tag | issue:3307818259 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/typing_extensions/643/issue_layout |
| twitter:image | https://opengraph.githubassets.com/77e574960ebcd8bc4bfc7f8f0a8e00807d95069cdfe854c35beeab20e3a61177/python/typing_extensions/issues/643 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/77e574960ebcd8bc4bfc7f8f0a8e00807d95069cdfe854c35beeab20e3a61177/python/typing_extensions/issues/643 |
| og:image:alt | Currently, both typing.get_type_hints and typing_extensions.get_type_hints fail on a lone stringified ClassVar annotation in Python 3.9 and 3.10: from __future__ import annotations from typing impo... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ItsDrike |
| hostname | github.com |
| expected-hostname | github.com |
| None | b278ad162d35332b6de714dfb005de04386c4d92df6475522bef910f491a35ee |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typing_extensions git https://github.com/python/typing_extensions.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 494077289 |
| octolytics-dimension-repository_nwo | python/typing_extensions |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 494077289 |
| octolytics-dimension-repository_network_root_nwo | python/typing_extensions |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 39aed5006635ab6f45e6b77d23e73b08a00272a3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width