Title: Add a C API to assign a new version to a PyTypeObject · Issue #103091 · python/cpython · GitHub
Open Graph Title: Add a C API to assign a new version to a PyTypeObject · Issue #103091 · python/cpython
X Title: Add a C API to assign a new version to a PyTypeObject · Issue #103091 · python/cpython
Description: Feature or enhancement I would like to add an API function like this: /* Attempt to assign a version tag to the given type. * * Returns 1 if the type already had a valid version tag or a new one was * assigned, or 0 if a new tag could no...
Open Graph Description: Feature or enhancement I would like to add an API function like this: /* Attempt to assign a version tag to the given type. * * Returns 1 if the type already had a valid version tag or a new one wa...
X Description: Feature or enhancement I would like to add an API function like this: /* Attempt to assign a version tag to the given type. * * Returns 1 if the type already had a valid version tag or a new one wa...
Opengraph URL: https://github.com/python/cpython/issues/103091
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add a C API to assign a new version to a PyTypeObject","articleBody":"# Feature or enhancement\r\n\r\nI would like to add an API function like this:\r\n```\r\n/* Attempt to assign a version tag to the given type.\r\n *\r\n * Returns 1 if the type already had a valid version tag or a new one was\r\n * assigned, or 0 if a new tag could not be assigned.\r\n */\r\nPyAPI_FUNC(int) _PyType_AssignVersionTag(PyTypeObject* type);\r\n```\r\n\r\nIt would be a thin wrapper around the existing [`assign_version_tag`](https://github.com/python/cpython/blob/main/Objects/typeobject.c#L568-L599) function, and is modeled after a similar function we added to Cinder as part of https://github.com/facebookincubator/cinder/commit/43c4e2dfe0e4a967251a72468adfc6602011dbda.\r\n\r\n# Pitch\r\n\r\nCinder (and possibly other JITs or optimizing interpreters) would benefit from being able to ensure that type has a valid version tag without having to call `_PyType_Lookup()` just for the version-assigning side-effect. We rely on notifications from `PyType_Modified()` to invalidate code in our JIT when types change, and this only works when the types in question have valid version tags.\r\n\r\n# Previous discussion\r\n\r\nThere's no written discussion I'm aware of, but @carljm and @markshannon have discussed this offline.\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-103095\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/swtaarrs","@type":"Person","name":"swtaarrs"},"datePublished":"2023-03-28T18:20:01.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/103091/cpython/issues/103091"}
| 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:a94baf3b-d90a-c042-b51e-80fd49f275b8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EC78:194D77:57C18B:7BAD16:696A0E73 |
| html-safe-nonce | 1204e77e84d56f45f00ddf71f45c648c9feeb2589b35d7309e8c1d4a1e7def8c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQzc4OjE5NEQ3Nzo1N0MxOEI6N0JBRDE2OjY5NkEwRTczIiwidmlzaXRvcl9pZCI6IjMwNzMzNDIxNjQ4NTUwMzM0NTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | ebe7c6c2df3eb3976fe461a9fe7304651c813c411d8a3995d7e2a7280ad9bea9 |
| hovercard-subject-tag | issue:1644455753 |
| 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/103091/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7ef5f1d53fe527e4d3d2f19e4dc2b494c88d4a5e9c8d1d4df24eb056e07b736b/python/cpython/issues/103091 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7ef5f1d53fe527e4d3d2f19e4dc2b494c88d4a5e9c8d1d4df24eb056e07b736b/python/cpython/issues/103091 |
| og:image:alt | Feature or enhancement I would like to add an API function like this: /* Attempt to assign a version tag to the given type. * * Returns 1 if the type already had a valid version tag or a new one wa... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | swtaarrs |
| hostname | github.com |
| expected-hostname | github.com |
| None | 699227a00bbb7fe1eec276d2ae1c3a93068bc5ba483bd9dc4b2a27a8f4f2f595 |
| 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 | 7266b2d935baa1c6474b16dd9feaa5ca30607261 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width