Title: typing._type_check no longer recognizes several kinds of non-types · Issue #92601 · python/cpython · GitHub
Open Graph Title: typing._type_check no longer recognizes several kinds of non-types · Issue #92601 · python/cpython
X Title: typing._type_check no longer recognizes several kinds of non-types · Issue #92601 · python/cpython
Description: Bug report The internal function typing._type_check() is used extensively to check whether a particular value represents a type. Its docstring begins with: def _type_check(arg, msg, is_argument=True, module=None, *, allow_special_forms=F...
Open Graph Description: Bug report The internal function typing._type_check() is used extensively to check whether a particular value represents a type. Its docstring begins with: def _type_check(arg, msg, is_argument=Tru...
X Description: Bug report The internal function typing._type_check() is used extensively to check whether a particular value represents a type. Its docstring begins with: def _type_check(arg, msg, is_argument=Tru...
Opengraph URL: https://github.com/python/cpython/issues/92601
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"typing._type_check no longer recognizes several kinds of non-types","articleBody":"**Bug report**\r\n\r\nThe internal function `typing._type_check()` is used extensively to check whether a particular value represents a type. Its docstring begins with:\r\n\r\n```\r\ndef _type_check(arg, msg, is_argument=True, module=None, *, allow_special_forms=False):\r\n \"\"\"Check that the argument is a type, and return it (internal helper).\r\n```\r\n\r\nIn Python 3.11b1 this function no longer errors on various kinds of non-types:\r\n\r\n```python\r\n\u003e\u003e\u003e import sys\r\n\u003e\u003e\u003e sys.version_info\r\nsys.version_info(major=3, minor=11, micro=0, releaselevel='beta', serial=1)\r\n\u003e\u003e\u003e import typing\r\n\u003e\u003e\u003e typing._type_check(5, \"Expected a type.\")\r\n# no error!\r\n\u003e\u003e\u003e typing.ClassVar[5]\r\ntyping.ClassVar[5] # no error!\r\n```\r\n\r\nBy contrast on Python 3.10:\r\n\r\n```python\r\n\u003e\u003e\u003e import sys\r\n\u003e\u003e\u003e sys.version_info\r\nsys.version_info(major=3, minor=10, micro=1, releaselevel='final', serial=0)\r\n\u003e\u003e\u003e import typing\r\n\u003e\u003e\u003e typing._type_check(5, \"Expected a type.\")\r\nTypeError: Expected a type. Got 5.\r\n\u003e\u003e\u003e typing.ClassVar[5]\r\nTypeError: typing.ClassVar accepts only single type. Got 5.\r\n```\r\n\r\n**Your environment**\r\n\r\nRegression introduced somewhere between Python 3.10 and Python 3.11b1.","author":{"url":"https://github.com/davidfstr","@type":"Person","name":"davidfstr"},"datePublished":"2022-05-10T04:50:08.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/92601/cpython/issues/92601"}
| 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:0dc4f38b-681f-1114-9675-d3d8d5e3f374 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E2A2:27E9DD:19DE21E:2446663:696A4F23 |
| html-safe-nonce | 254b289dd34b640a20907cbdca014dc211aadce13aecb954f814e9915ba85988 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMkEyOjI3RTlERDoxOURFMjFFOjI0NDY2NjM6Njk2QTRGMjMiLCJ2aXNpdG9yX2lkIjoiNzY2MjE0MjE3MDg3MjgyNzY4MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ed90d729cfa0177fba8fba0c7214e1fd9c07e02e1f35bd0b23454b409338dd80 |
| hovercard-subject-tag | issue:1230614714 |
| 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/92601/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fe1bf80145c9266224ebc5018d0a408f0a2ddc4e636914c9015843d466aa8bb8/python/cpython/issues/92601 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fe1bf80145c9266224ebc5018d0a408f0a2ddc4e636914c9015843d466aa8bb8/python/cpython/issues/92601 |
| og:image:alt | Bug report The internal function typing._type_check() is used extensively to check whether a particular value represents a type. Its docstring begins with: def _type_check(arg, msg, is_argument=Tru... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | davidfstr |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3f871c8e07f0ae1886fa8dac284166d28b09ad5bada6476fc10b674e489788ef |
| 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 | 63c426b30d262aba269ef14c40e3c817b384cd61 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width