mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
_PyObject_GC_New: Could call PyObject_INIT with a NULL 1st argument.
_PyObject_GC_NewVar: Could call PyObject_INIT_VAR likewise. Bugfix candidate.
This commit is contained in:
parent
5de9842b34
commit
fa8efab30f
1 changed files with 6 additions and 2 deletions
|
@ -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 *
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue