Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add a C API to assign a new version to a PyTypeObject #103091

Copy link
Copy link
Closed
@swtaarrs

Description

@swtaarrs
Issue body actions

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 not be assigned.
 */
PyAPI_FUNC(int) _PyType_AssignVersionTag(PyTypeObject* type);

It would be a thin wrapper around the existing assign_version_tag function, and is modeled after a similar function we added to Cinder as part of facebookincubator/cinder@43c4e2d.

Pitch

Cinder (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.

Previous discussion

There's no written discussion I'm aware of, but @carljm and @markshannon have discussed this offline.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.