(some tweaking for different _PyObject_GC_Malloc() call in 2.2. checked,
still returns the same thing on failure...)
_PyObject_GC_New: Could call PyObject_INIT with a NULL 1st argument.
_PyObject_GC_NewVar: Could call PyObject_INIT_VAR likewise.
Bugfix candidate.
Original patch(es):
python/dist/src/Modules/gcmodule.c:2.40
_PyObject_GC_New(PyTypeObject *tp)
{
PyObject *op = _PyObject_GC_Malloc(tp, 0);
- return PyObject_INIT(op, tp);
+ if (op != NULL)
+ op = PyObject_INIT(op, tp);
+ return op;
}
PyVarObject *
_PyObject_GC_NewVar(PyTypeObject *tp, int nitems)
{
PyVarObject *op = (PyVarObject *) _PyObject_GC_Malloc(tp, nitems);
- return PyObject_INIT_VAR(op, tp, nitems);
+ if (op != NULL)
+ op = PyObject_INIT_VAR(op, tp, nitems);
+ return op;
}
PyVarObject *