summaryrefslogtreecommitdiffstats
path: root/Modules/_testcapimodule.c
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2023-11-22 22:03:33 (GMT)
committerGitHub <noreply@github.com>2023-11-22 22:03:33 (GMT)
commit790db85c7737c2ebbb145f9a26f675a586c5f0d1 (patch)
tree6f8e50af6d9e3eb470dc79a4d305eb77d79da9ae /Modules/_testcapimodule.c
parent5c3a129ecfbaac107bccf3083533276ee0ccc036 (diff)
downloadcpython-790db85c7737c2ebbb145f9a26f675a586c5f0d1.zip
cpython-790db85c7737c2ebbb145f9a26f675a586c5f0d1.tar.gz
cpython-790db85c7737c2ebbb145f9a26f675a586c5f0d1.tar.bz2
gh-76785: Add _PyType_GetModuleName() to the Internal C-API (gh-112323)
The new function corresponds to the existing (public) PyType_GetName() and PyType_GetQualName().
Diffstat (limited to 'Modules/_testcapimodule.c')
-rw-r--r--Modules/_testcapimodule.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 999bd86..9fdd670 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -570,6 +570,12 @@ static PyType_Spec HeapTypeNameType_Spec = {
};
static PyObject *
+get_heaptype_for_name(PyObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return PyType_FromSpec(&HeapTypeNameType_Spec);
+}
+
+static PyObject *
test_get_type_name(PyObject *self, PyObject *Py_UNUSED(ignored))
{
PyObject *tp_name = PyType_GetName(&PyLong_Type);
@@ -3210,6 +3216,7 @@ static PyMethodDef TestMethods[] = {
{"py_buildvalue_ints", py_buildvalue_ints, METH_VARARGS},
{"test_buildvalue_N", test_buildvalue_N, METH_NOARGS},
{"test_get_statictype_slots", test_get_statictype_slots, METH_NOARGS},
+ {"get_heaptype_for_name", get_heaptype_for_name, METH_NOARGS},
{"test_get_type_name", test_get_type_name, METH_NOARGS},
{"test_get_type_qualname", test_get_type_qualname, METH_NOARGS},
{"test_get_type_dict", test_get_type_dict, METH_NOARGS},