diff options
author | Tim Peters <tim.peters@gmail.com> | 2002-04-28 01:57:25 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2002-04-28 01:57:25 (GMT) |
commit | fa8efab30f74a13a91795a1ef074b92299a0af9d (patch) | |
tree | a4b94e0732f32ee87d5e390bad2ad3eb482acbce /Modules | |
parent | 5de9842b34cbefbfe74e6a99004616352f223133 (diff) | |
download | cpython-fa8efab30f74a13a91795a1ef074b92299a0af9d.zip cpython-fa8efab30f74a13a91795a1ef074b92299a0af9d.tar.gz cpython-fa8efab30f74a13a91795a1ef074b92299a0af9d.tar.bz2 |
_PyObject_GC_New: Could call PyObject_INIT with a NULL 1st argument.
_PyObject_GC_NewVar: Could call PyObject_INIT_VAR likewise.
Bugfix candidate.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/gcmodule.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index 66f7032..fd9f265 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -878,7 +878,9 @@ PyObject * _PyObject_GC_New(PyTypeObject *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 * @@ -886,7 +888,9 @@ _PyObject_GC_NewVar(PyTypeObject *tp, int nitems) { const size_t size = _PyObject_VAR_SIZE(tp, nitems); 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 * |