mirror of
https://github.com/python/cpython.git
synced 2025-12-09 18:48:05 +00:00
gh-106320: Remove private _PyTraceMalloc C API functions (#106324)
* Remove private _PyTraceMalloc C API functions: move them to the internal C API. * Don't export most of these functions anymore, but still export _PyTraceMalloc_GetTraceback() used by tests. * Rename Include/tracemalloc.h to Include/cpython/tracemalloc.h
This commit is contained in:
parent
18b1fdebe0
commit
feb51f3a64
10 changed files with 99 additions and 98 deletions
|
|
@ -1216,6 +1216,24 @@ test_pytime_object_to_timespec(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
|
||||
static PyObject *
|
||||
tracemalloc_get_traceback(PyObject *self, PyObject *args)
|
||||
{
|
||||
unsigned int domain;
|
||||
PyObject *ptr_obj;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "IO", &domain, &ptr_obj)) {
|
||||
return NULL;
|
||||
}
|
||||
void *ptr = PyLong_AsVoidPtr(ptr_obj);
|
||||
if (PyErr_Occurred()) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return _PyTraceMalloc_GetTraceback(domain, (uintptr_t)ptr);
|
||||
}
|
||||
|
||||
|
||||
static PyMethodDef module_functions[] = {
|
||||
{"get_configs", get_configs, METH_NOARGS},
|
||||
{"get_recursion_depth", get_recursion_depth, METH_NOARGS},
|
||||
|
|
@ -1250,7 +1268,6 @@ static PyMethodDef module_functions[] = {
|
|||
{"get_uop_optimizer", get_uop_optimizer, METH_NOARGS, NULL},
|
||||
{"pending_threadfunc", _PyCFunction_CAST(pending_threadfunc),
|
||||
METH_VARARGS | METH_KEYWORDS},
|
||||
// {"pending_fd_identify", pending_fd_identify, METH_VARARGS, NULL},
|
||||
{"pending_identify", pending_identify, METH_VARARGS, NULL},
|
||||
{"_PyTime_AsMicroseconds", test_PyTime_AsMicroseconds, METH_VARARGS},
|
||||
{"_PyTime_AsMilliseconds", test_PyTime_AsMilliseconds, METH_VARARGS},
|
||||
|
|
@ -1266,6 +1283,7 @@ static PyMethodDef module_functions[] = {
|
|||
{"_PyTime_ObjectToTime_t", test_pytime_object_to_time_t, METH_VARARGS},
|
||||
{"_PyTime_ObjectToTimespec", test_pytime_object_to_timespec, METH_VARARGS},
|
||||
{"_PyTime_ObjectToTimeval", test_pytime_object_to_timeval, METH_VARARGS},
|
||||
{"_PyTraceMalloc_GetTraceback", tracemalloc_get_traceback, METH_VARARGS},
|
||||
{NULL, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue