Add pymalloc object memory management functions. These must be
available even if pymalloc is disabled since extension modules might use
them.
diff --git a/Objects/object.c b/Objects/object.c
index 1602e89..494e840 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -2109,3 +2109,27 @@
PyMem_FREE(p);
}
#endif /* !WITH_PYMALLOC */
+
+PyObject *_PyMalloc_New(PyTypeObject *tp)
+{
+ PyObject *op;
+ op = (PyObject *) _PyMalloc_MALLOC(_PyObject_SIZE(tp));
+ if (op == NULL)
+ return PyErr_NoMemory();
+ return PyObject_INIT(op, tp);
+}
+
+PyVarObject *_PyMalloc_NewVar(PyTypeObject *tp, int nitems)
+{
+ PyVarObject *op;
+ const size_t size = _PyObject_VAR_SIZE(tp, nitems);
+ op = (PyVarObject *) _PyMalloc_MALLOC(size);
+ if (op == NULL)
+ return (PyVarObject *)PyErr_NoMemory();
+ return PyObject_INIT_VAR(op, tp, nitems);
+}
+
+void _PyMalloc_Del(PyObject *op)
+{
+ _PyMalloc_FREE(op);
+}