@@ -2733,6 +2733,18 @@ type_get_version(PyObject *self, PyObject *type)
2733
2733
}
2734
2734
2735
2735
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
+
2736
2748
// Test PyThreadState C API
2737
2749
static PyObject *
2738
2750
test_tstate_capi (PyObject * self , PyObject * Py_UNUSED (args ))
@@ -3530,6 +3542,7 @@ static PyMethodDef TestMethods[] = {
3530
3542
{"test_py_is_macros" , test_py_is_macros , METH_NOARGS },
3531
3543
{"test_py_is_funcs" , test_py_is_funcs , METH_NOARGS },
3532
3544
{"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" )},
3533
3546
{"test_tstate_capi" , test_tstate_capi , METH_NOARGS , NULL },
3534
3547
{"frame_getlocals" , frame_getlocals , METH_O , NULL },
3535
3548
{"frame_getglobals" , frame_getglobals , METH_O , NULL },
0 commit comments