bpo-43244: Remove the pyarena.h header (GH-25007)

Remove the pyarena.h header file with functions:

* PyArena_New()
* PyArena_Free()
* PyArena_Malloc()
* PyArena_AddPyObject()

These functions were undocumented, excluded from the limited C API,
and were only used internally by the compiler.

Add pycore_pyarena.h header. Rename functions:

* PyArena_New() => _PyArena_New()
* PyArena_Free() => _PyArena_Free()
* PyArena_Malloc() => _PyArena_Malloc()
* PyArena_AddPyObject() => _PyArena_AddPyObject()
This commit is contained in:
Victor Stinner 2021-03-24 02:23:01 +01:00 committed by GitHub
parent 919d42d477
commit 8370e07e1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 215 additions and 187 deletions

View file

@ -1,4 +1,5 @@
#include "Python.h"
#include "pycore_pyarena.h" // PyArena
/* A simple arena block structure.
@ -125,7 +126,7 @@ block_alloc(block *b, size_t size)
}
PyArena *
PyArena_New()
_PyArena_New(void)
{
PyArena* arena = (PyArena *)PyMem_Malloc(sizeof(PyArena));
if (!arena)
@ -154,7 +155,7 @@ PyArena_New()
}
void
PyArena_Free(PyArena *arena)
_PyArena_Free(PyArena *arena)
{
assert(arena);
#if defined(Py_DEBUG)
@ -177,7 +178,7 @@ PyArena_Free(PyArena *arena)
}
void *
PyArena_Malloc(PyArena *arena, size_t size)
_PyArena_Malloc(PyArena *arena, size_t size)
{
void *p = block_alloc(arena->a_cur, size);
if (!p)
@ -200,7 +201,7 @@ PyArena_Malloc(PyArena *arena, size_t size)
}
int
PyArena_AddPyObject(PyArena *arena, PyObject *obj)
_PyArena_AddPyObject(PyArena *arena, PyObject *obj)
{
int r = PyList_Append(arena->a_objects, obj);
if (r >= 0) {