From: Anthony Baxter Date: Tue, 30 Apr 2002 03:33:15 +0000 (+0000) Subject: backport tim_one's patch: X-Git-Tag: v2.2.2b1~398 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=07fb92a86f4428a0d1d827b6b18101afe77cdd15;p=thirdparty%2FPython%2Fcpython.git backport tim_one's patch: (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 --- diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index e3bb669d3615..83fb8747bddc 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -861,14 +861,18 @@ PyObject * _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 *