Closed
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 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.
Activity