Commit 4bb67e61 authored by Tim Peters's avatar Tim Peters

_PyObject_GC_New: Could call PyObject_INIT with a NULL 1st argument.

_PyObject_GC_NewVar:  Could call PyObject_INIT_VAR likewise.

Bugfix candidate.
parent 6d833302
...@@ -878,7 +878,9 @@ PyObject * ...@@ -878,7 +878,9 @@ PyObject *
_PyObject_GC_New(PyTypeObject *tp) _PyObject_GC_New(PyTypeObject *tp)
{ {
PyObject *op = _PyObject_GC_Malloc(_PyObject_SIZE(tp)); PyObject *op = _PyObject_GC_Malloc(_PyObject_SIZE(tp));
return PyObject_INIT(op, tp); if (op != NULL)
op = PyObject_INIT(op, tp);
return op;
} }
PyVarObject * PyVarObject *
...@@ -886,7 +888,9 @@ _PyObject_GC_NewVar(PyTypeObject *tp, int nitems) ...@@ -886,7 +888,9 @@ _PyObject_GC_NewVar(PyTypeObject *tp, int nitems)
{ {
const size_t size = _PyObject_VAR_SIZE(tp, nitems); const size_t size = _PyObject_VAR_SIZE(tp, nitems);
PyVarObject *op = (PyVarObject *) _PyObject_GC_Malloc(size); PyVarObject *op = (PyVarObject *) _PyObject_GC_Malloc(size);
return PyObject_INIT_VAR(op, tp, nitems); if (op != NULL)
op = PyObject_INIT_VAR(op, tp, nitems);
return op;
} }
PyVarObject * PyVarObject *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment