Title: We need equivalent of parse_type_string() in native parser · Issue #21515 · python/mypy · GitHub
Open Graph Title: We need equivalent of parse_type_string() in native parser · Issue #21515 · python/mypy
X Title: We need equivalent of parse_type_string() in native parser · Issue #21515 · python/mypy
Description: This is needed to parse an arbitrary string as a type. This is especially important in context of TypeForm support (but is still needed in various other cases where we implicitly use old parser now, e.g. cast(), type alias targets etc). ...
Open Graph Description: This is needed to parse an arbitrary string as a type. This is especially important in context of TypeForm support (but is still needed in various other cases where we implicitly use old parser now...
X Description: This is needed to parse an arbitrary string as a type. This is especially important in context of TypeForm support (but is still needed in various other cases where we implicitly use old parser now...
Opengraph URL: https://github.com/python/mypy/issues/21515
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"We need equivalent of parse_type_string() in native parser","articleBody":"This is needed to parse an arbitrary string as a type. This is especially important in context of `TypeForm` support (but is still needed in various other cases where we implicitly use old parser now, e.g. `cast()`, type alias targets etc).\n\nSince we may make many calls to this function per file, overhead of using a Python call may be significant. We should probably consider adding a mypyc primitive for this that would use a capsule import from `ast_serialize`. It looks like PyO3 does support capsules, see https://docs.rs/pyo3/latest/pyo3/types/struct.PyCapsule.html\n\nWe can have a dedicated function in `ast_serialize` with a (much) simpler signature that also doesn't try to serialize imports etc.\n\n@JukkaL what do you think?\n","author":{"url":"https://github.com/ilevkivskyi","@type":"Person","name":"ilevkivskyi"},"datePublished":"2026-05-19T21:15:38.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/21515/mypy/issues/21515"}
| 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:e459acd8-0f7d-8ace-737e-cabcbbdda7ba |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E7E2:171F06:C2232F:FFA7E7:6A4C493A |
| html-safe-nonce | 6277956295b2814a2b09b829b384906da6c281501198fbeefa80ec1251cd76d6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFN0UyOjE3MUYwNjpDMjIzMkY6RkZBN0U3OjZBNEM0OTNBIiwidmlzaXRvcl9pZCI6IjIzNjA4NTg5NjA3ODM0OTM0MzQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7e2e5f94619757a12c1305cabbbe146a96ecc21942be9c50948de016329188e7 |
| hovercard-subject-tag | issue:4481106875 |
| 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/mypy/21515/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4eb0d26380114448997a4d26ec629b9853b071a4f701784d831003f114987705/python/mypy/issues/21515 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4eb0d26380114448997a4d26ec629b9853b071a4f701784d831003f114987705/python/mypy/issues/21515 |
| og:image:alt | This is needed to parse an arbitrary string as a type. This is especially important in context of TypeForm support (but is still needed in various other cases where we implicitly use old parser now... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ilevkivskyi |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c |
| turbo-cache-control | no-preview |
| go-import | github.com/python/mypy git https://github.com/python/mypy.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 7053637 |
| octolytics-dimension-repository_nwo | python/mypy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7053637 |
| octolytics-dimension-repository_network_root_nwo | python/mypy |
| 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 | 3996b3b83990e134be6c099ab9a7f48f140ae80f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width