|
27 | 27 | #include "pycore_pathconfig.h" // _PyPathConfig_ClearGlobal() |
28 | 28 | #include "pycore_pyerrors.h" // _PyErr_ChainExceptions1() |
29 | 29 | #include "pycore_pystate.h" // _PyThreadState_GET() |
| 30 | +#include "pycore_typeobject.h" // _PyType_GetModuleName() |
30 | 31 |
|
31 | 32 | #include "interpreteridobject.h" // PyInterpreterID_LookUp() |
32 | 33 |
|
@@ -1616,6 +1617,14 @@ perf_trampoline_set_persist_after_fork(PyObject *self, PyObject *args) |
1616 | 1617 | } |
1617 | 1618 |
|
1618 | 1619 |
|
| 1620 | +static PyObject * |
| 1621 | +get_type_module_name(PyObject *self, PyObject *type) |
| 1622 | +{ |
| 1623 | + assert(PyType_Check(type)); |
| 1624 | + return _PyType_GetModuleName((PyTypeObject *)type); |
| 1625 | +} |
| 1626 | + |
| 1627 | + |
1619 | 1628 | static PyMethodDef module_functions[] = { |
1620 | 1629 | {"get_configs", get_configs, METH_NOARGS}, |
1621 | 1630 | {"get_recursion_depth", get_recursion_depth, METH_NOARGS}, |
@@ -1678,6 +1687,7 @@ static PyMethodDef module_functions[] = { |
1678 | 1687 | {"get_crossinterp_data", get_crossinterp_data, METH_VARARGS}, |
1679 | 1688 | {"restore_crossinterp_data", restore_crossinterp_data, METH_VARARGS}, |
1680 | 1689 | _TESTINTERNALCAPI_TEST_LONG_NUMBITS_METHODDEF |
| 1690 | + {"get_type_module_name", get_type_module_name, METH_O}, |
1681 | 1691 | {NULL, NULL} /* sentinel */ |
1682 | 1692 | }; |
1683 | 1693 |
|
|
0 commit comments