mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
gh-106320: Remove private _PyMem API (#107187)
Move private _PyMem functions to the internal C API (pycore_pymem.h): * _PyMem_GetCurrentAllocatorName() * _PyMem_RawStrdup() * _PyMem_RawWcsdup() * _PyMem_Strdup() No longer export these functions. Move pymem_getallocatorsname() function from _testcapi to _testinternalcapi, since the API moved to the internal C API.
This commit is contained in:
parent
d27eb1e406
commit
307186704d
8 changed files with 38 additions and 35 deletions
|
@ -1519,6 +1519,18 @@ check_pyobject_freed_is_freed(PyObject *self, PyObject *Py_UNUSED(args))
|
|||
}
|
||||
|
||||
|
||||
static PyObject *
|
||||
test_pymem_getallocatorsname(PyObject *self, PyObject *args)
|
||||
{
|
||||
const char *name = _PyMem_GetCurrentAllocatorName();
|
||||
if (name == NULL) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "cannot get allocators name");
|
||||
return NULL;
|
||||
}
|
||||
return PyUnicode_FromString(name);
|
||||
}
|
||||
|
||||
|
||||
static PyMethodDef module_functions[] = {
|
||||
{"get_configs", get_configs, METH_NOARGS},
|
||||
{"get_recursion_depth", get_recursion_depth, METH_NOARGS},
|
||||
|
@ -1581,6 +1593,7 @@ static PyMethodDef module_functions[] = {
|
|||
{"check_pyobject_null_is_freed", check_pyobject_null_is_freed, METH_NOARGS},
|
||||
{"check_pyobject_uninitialized_is_freed",
|
||||
check_pyobject_uninitialized_is_freed, METH_NOARGS},
|
||||
{"pymem_getallocatorsname", test_pymem_getallocatorsname, METH_NOARGS},
|
||||
{NULL, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue