@@ -35,11 +35,23 @@ extern "C" {
3535 PyAPI_FUNC (PyArena * ) PyArena_New (void );
3636 PyAPI_FUNC (void ) PyArena_Free (PyArena * );
3737
38- PyAPI_FUNC (void * ) PyArena_Malloc (PyArena * , size_t );
38+ /* Mostly like malloc(), return the address of a block of memory spanning
39+ * `size` bytes, or return NULL (without setting an exception) if enough
40+ * new memory can't be obtained. Unlike malloc(0), PyArena_Malloc() with
41+ * size=0 does not guarantee to return a unique pointer (the pointer
42+ * returned may equal one or more other pointers obtained from
43+ * PyArena_Malloc()).
44+ * Note that pointers obtained via PyArena_Malloc() must never be passed to
45+ * the system free() or realloc(), or to any of Python's similar memory-
46+ * management functions. PyArena_Malloc()-obtained pointers remain valid
47+ * until PyArena_Free(ar) is called, at which point all pointers obtained
48+ * from the arena `ar` become invalid simultaneously.
49+ */
50+ PyAPI_FUNC (void * ) PyArena_Malloc (PyArena * , size_t size );
3951
40- /* This routines isn't a proper arena allocation routine. It takes
41- a PyObject* and records it so that it can be DECREFed when the
42- arena is freed.
52+ /* This routine isn't a proper arena allocation routine. It takes
53+ * a PyObject* and records it so that it can be DECREFed when the
54+ * arena is freed.
4355 */
4456 PyAPI_FUNC (int ) PyArena_AddPyObject (PyArena * , PyObject * );
4557
0 commit comments