summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Objects/object.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/Objects/object.c b/Objects/object.c
index 523a881..20a6a93 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -109,11 +109,8 @@ _Py_NegativeRefcount(const char *fname, int lineno, PyObject *op)
PyObject *
PyObject_Init(PyObject *op, PyTypeObject *tp)
{
- if (op == NULL) {
- PyErr_SetString(PyExc_SystemError,
- "NULL object passed to PyObject_Init");
- return op;
- }
+ if (op == NULL)
+ return PyErr_NoMemory();
/* Any changes should be reflected in PyObject_INIT (objimpl.h) */
op->ob_type = tp;
_Py_NewReference(op);
@@ -123,11 +120,8 @@ PyObject_Init(PyObject *op, PyTypeObject *tp)
PyVarObject *
PyObject_InitVar(PyVarObject *op, PyTypeObject *tp, int size)
{
- if (op == NULL) {
- PyErr_SetString(PyExc_SystemError,
- "NULL object passed to PyObject_InitVar");
- return op;
- }
+ if (op == NULL)
+ return (PyVarObject *) PyErr_NoMemory();
/* Any changes should be reflected in PyObject_INIT_VAR */
op->ob_size = size;
op->ob_type = tp;