gh-106320: Remove private _PyTraceMalloc C API functions (#106324) · python/cpython@feb51f3

GitHub

@@ -1216,6 +1216,24 @@ test_pytime_object_to_timespec(PyObject *self, PyObject *args)

12161216}

12171217121812181219+staticPyObject*

1220+tracemalloc_get_traceback(PyObject*self, PyObject*args)

1221+{

1222+unsigned intdomain;

1223+PyObject*ptr_obj;

1224+1225+if (!PyArg_ParseTuple(args, "IO", &domain, &ptr_obj)) {

1226+returnNULL;

1227+ }

1228+void*ptr=PyLong_AsVoidPtr(ptr_obj);

1229+if (PyErr_Occurred()) {

1230+returnNULL;

1231+ }

1232+1233+return_PyTraceMalloc_GetTraceback(domain, (uintptr_t)ptr);

1234+}

1235+1236+12191237staticPyMethodDefmodule_functions[] = {

12201238 {"get_configs", get_configs, METH_NOARGS},

12211239 {"get_recursion_depth", get_recursion_depth, METH_NOARGS},

@@ -1250,7 +1268,6 @@ static PyMethodDef module_functions[] = {

12501268 {"get_uop_optimizer", get_uop_optimizer, METH_NOARGS, NULL},

12511269 {"pending_threadfunc", _PyCFunction_CAST(pending_threadfunc),

12521270METH_VARARGS | METH_KEYWORDS},

1253-// {"pending_fd_identify", pending_fd_identify, METH_VARARGS, NULL},

12541271 {"pending_identify", pending_identify, METH_VARARGS, NULL},

12551272 {"_PyTime_AsMicroseconds", test_PyTime_AsMicroseconds, METH_VARARGS},

12561273 {"_PyTime_AsMilliseconds", test_PyTime_AsMilliseconds, METH_VARARGS},

@@ -1266,6 +1283,7 @@ static PyMethodDef module_functions[] = {

12661283 {"_PyTime_ObjectToTime_t", test_pytime_object_to_time_t, METH_VARARGS},

12671284 {"_PyTime_ObjectToTimespec", test_pytime_object_to_timespec, METH_VARARGS},

12681285 {"_PyTime_ObjectToTimeval", test_pytime_object_to_timeval, METH_VARARGS},

1286+ {"_PyTraceMalloc_GetTraceback", tracemalloc_get_traceback, METH_VARARGS},

12691287 {NULL, NULL} /* sentinel */

12701288};

12711289