diff options
author | Brett Simmers <swtaarrs@users.noreply.github.com> | 2023-04-24 16:07:47 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-24 16:07:47 (GMT) |
commit | b7f4811c88609d1ff12f42a3335fda49f8a478f3 (patch) | |
tree | 9d66278478d9c33b743a1cc77677bff7c847a963 /Modules | |
parent | dca27a69a8261353f7f986eb8f808f0d487ac4b7 (diff) | |
download | cpython-b7f4811c88609d1ff12f42a3335fda49f8a478f3.zip cpython-b7f4811c88609d1ff12f42a3335fda49f8a478f3.tar.gz cpython-b7f4811c88609d1ff12f42a3335fda49f8a478f3.tar.bz2 |
gh-103091: Add PyUnstable_Type_AssignVersionTag (#103095)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_testcapimodule.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 557a6d4..30b2674 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -2733,6 +2733,18 @@ type_get_version(PyObject *self, PyObject *type) } +static PyObject * +type_assign_version(PyObject *self, PyObject *type) +{ + if (!PyType_Check(type)) { + PyErr_SetString(PyExc_TypeError, "argument must be a type"); + return NULL; + } + int res = PyUnstable_Type_AssignVersionTag((PyTypeObject *)type); + return PyLong_FromLong(res); +} + + // Test PyThreadState C API static PyObject * test_tstate_capi(PyObject *self, PyObject *Py_UNUSED(args)) @@ -3530,6 +3542,7 @@ static PyMethodDef TestMethods[] = { {"test_py_is_macros", test_py_is_macros, METH_NOARGS}, {"test_py_is_funcs", test_py_is_funcs, METH_NOARGS}, {"type_get_version", type_get_version, METH_O, PyDoc_STR("type->tp_version_tag")}, + {"type_assign_version", type_assign_version, METH_O, PyDoc_STR("PyUnstable_Type_AssignVersionTag")}, {"test_tstate_capi", test_tstate_capi, METH_NOARGS, NULL}, {"frame_getlocals", frame_getlocals, METH_O, NULL}, {"frame_getglobals", frame_getglobals, METH_O, NULL}, |