@@ -2733,6 +2733,18 @@ type_get_version(PyObject *self, PyObject *type)
27332733}
27342734
27352735
2736+ static PyObject *
2737+ type_assign_version (PyObject * self , PyObject * type )
2738+ {
2739+ if (!PyType_Check (type )) {
2740+ PyErr_SetString (PyExc_TypeError , "argument must be a type" );
2741+ return NULL ;
2742+ }
2743+ int res = PyUnstable_Type_AssignVersionTag ((PyTypeObject * )type );
2744+ return PyLong_FromLong (res );
2745+ }
2746+
2747+
27362748// Test PyThreadState C API
27372749static PyObject *
27382750test_tstate_capi (PyObject * self , PyObject * Py_UNUSED (args ))
@@ -3530,6 +3542,7 @@ static PyMethodDef TestMethods[] = {
35303542 {"test_py_is_macros" , test_py_is_macros , METH_NOARGS },
35313543 {"test_py_is_funcs" , test_py_is_funcs , METH_NOARGS },
35323544 {"type_get_version" , type_get_version , METH_O , PyDoc_STR ("type->tp_version_tag" )},
3545+ {"type_assign_version" , type_assign_version , METH_O , PyDoc_STR ("PyUnstable_Type_AssignVersionTag" )},
35333546 {"test_tstate_capi" , test_tstate_capi , METH_NOARGS , NULL },
35343547 {"frame_getlocals" , frame_getlocals , METH_O , NULL },
35353548 {"frame_getglobals" , frame_getglobals , METH_O , NULL },
0 commit comments