mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Cleanup dictobject.c
This commit is contained in:
parent
fdcbab9602
commit
a9f61a5a23
1 changed files with 18 additions and 16 deletions
|
@ -2589,11 +2589,14 @@ static PyObject *
|
||||||
dict_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
dict_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
PyObject *self;
|
PyObject *self;
|
||||||
|
PyDictObject *d;
|
||||||
|
|
||||||
assert(type != NULL && type->tp_alloc != NULL);
|
assert(type != NULL && type->tp_alloc != NULL);
|
||||||
self = type->tp_alloc(type, 0);
|
self = type->tp_alloc(type, 0);
|
||||||
if (self != NULL) {
|
if (self == NULL)
|
||||||
PyDictObject *d = (PyDictObject *)self;
|
return NULL;
|
||||||
|
|
||||||
|
d = (PyDictObject *)self;
|
||||||
d->ma_keys = new_keys_object(PyDict_MINSIZE_COMBINED);
|
d->ma_keys = new_keys_object(PyDict_MINSIZE_COMBINED);
|
||||||
/* XXX - Should we raise a no-memory error? */
|
/* XXX - Should we raise a no-memory error? */
|
||||||
if (d->ma_keys == NULL) {
|
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 */
|
/* The object has been implicitly tracked by tp_alloc */
|
||||||
if (type == &PyDict_Type)
|
if (type == &PyDict_Type)
|
||||||
_PyObject_GC_UNTRACK(d);
|
_PyObject_GC_UNTRACK(d);
|
||||||
}
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue