Cleanup dictobject.c

This commit is contained in:
Victor Stinner 2013-07-16 22:17:26 +02:00
parent fdcbab9602
commit a9f61a5a23

View file

@ -2589,11 +2589,14 @@ static PyObject *
dict_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *self;
PyDictObject *d;
assert(type != NULL && type->tp_alloc != NULL);
self = type->tp_alloc(type, 0);
if (self != NULL) {
PyDictObject *d = (PyDictObject *)self;
if (self == NULL)
return NULL;
d = (PyDictObject *)self;
d->ma_keys = new_keys_object(PyDict_MINSIZE_COMBINED);
/* XXX - Should we raise a no-memory error? */
if (d->ma_keys == NULL) {
@ -2605,7 +2608,6 @@ dict_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
/* The object has been implicitly tracked by tp_alloc */
if (type == &PyDict_Type)
_PyObject_GC_UNTRACK(d);
}
return self;
}