Title: `typing.get_type_hints()` works for `Callable[[], None]` from the `typing` module, but not `collections.abc` · Issue #91621 · python/cpython · GitHub
Open Graph Title: `typing.get_type_hints()` works for `Callable[[], None]` from the `typing` module, but not `collections.abc` · Issue #91621 · python/cpython
X Title: `typing.get_type_hints()` works for `Callable[[], None]` from the `typing` module, but not `collections.abc` · Issue #91621 · python/cpython
Description: Bug report typing.get_type_hints() works for Callable[[], None] from the typing module, but not collections.abc. This is the standard way to annotate a callable which takes no arguments, and the generic types from typing should behave id...
Open Graph Description: Bug report typing.get_type_hints() works for Callable[[], None] from the typing module, but not collections.abc. This is the standard way to annotate a callable which takes no arguments, and the ge...
X Description: Bug report typing.get_type_hints() works for Callable[[], None] from the typing module, but not collections.abc. This is the standard way to annotate a callable which takes no arguments, and the ge...
Opengraph URL: https://github.com/python/cpython/issues/91621
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`typing.get_type_hints()` works for `Callable[[], None]` from the `typing` module, but not `collections.abc`","articleBody":"**Bug report**\r\n\r\n`typing.get_type_hints()` works for `Callable[[], None]` from the `typing` module, but not `collections.abc`. This is the standard way to annotate a callable which takes no arguments, and the generic types from `typing` should behave identically to those in `collections.abc`.\r\n\r\n```python\r\nimport collections.abc\r\nimport typing\r\n\r\ndef f1(x: typing.Callable[[], None]):\r\n pass\r\n\r\ndef f2(x: collections.abc.Callable[[], None]):\r\n pass\r\n\r\nassert \"x\" in typing.get_type_hints(f1)\r\ntyping.get_type_hints(f2) # Raises TypeError!\r\n```\r\n\r\n**Your environment**\r\n\r\nCPython 3.11.0a7 (and I believe back to a3), found via CI [for Hypothesis](https://github.com/HypothesisWorks/hypothesis/blob/ab8276d38ac573a841d0a5db0ce62abfc144298c/hypothesis-python/tests/cover/test_lookup_py37.py#L166-L167), and reproduced in Ubuntu/WSL2 locally. \r\n [I'm skipping that test for now](https://github.com/HypothesisWorks/hypothesis/blob/114bcad22cd234809c05a48c310be17d3c2d5a23/hypothesis-python/tests/cover/test_lookup_py37.py#L166-L179), and will re-enable when this is fixed.","author":{"url":"https://github.com/Zac-HD","@type":"Person","name":"Zac-HD"},"datePublished":"2022-04-16T22:21:03.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/91621/cpython/issues/91621"}
| 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:ac4f3e7b-4bb1-241c-5b05-c74551980eea |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8EBC:284E5C:1F6B1E8:2B271B0:696AB8C6 |
| html-safe-nonce | a232cad6afd775a91e712fee947131d0f79f4c3b9accb9a8032b65a04d3a02c6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RUJDOjI4NEU1QzoxRjZCMUU4OjJCMjcxQjA6Njk2QUI4QzYiLCJ2aXNpdG9yX2lkIjoiMjMyMTIxNjU5MzAxNTI1NzI4NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3d08b6f127b4de411e2ef162cfd2ef840ad0a5c5f8de42613c25a97f81abae6d |
| hovercard-subject-tag | issue:1206227838 |
| 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/cpython/91621/issue_layout |
| twitter:image | https://opengraph.githubassets.com/63b70421473333fef217df4806defcf6ac605580835a4a7c280beb9a2213201c/python/cpython/issues/91621 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/63b70421473333fef217df4806defcf6ac605580835a4a7c280beb9a2213201c/python/cpython/issues/91621 |
| og:image:alt | Bug report typing.get_type_hints() works for Callable[[], None] from the typing module, but not collections.abc. This is the standard way to annotate a callable which takes no arguments, and the ge... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Zac-HD |
| hostname | github.com |
| expected-hostname | github.com |
| None | 46ce962e0e18113ea447391b6ace8b02d4d2861e57b4fbab3658698f73d8855b |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| 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 | 30300f30bb3949de255e84a146706a3bdb5c19c9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width