mirror of https://github.com/python/cpython
bpo-43770: Refactor type_new() function (GH-25325)
* Split type_new() into into many small functions. * Add type_new_ctx structure to pass variables between subfunctions. * Initialize some PyTypeObject and PyHeapTypeObject members earlier in type_new_alloc(). * Rename variables to more specific names. * Add "__weakref__" identifier for type_new_visit_slots(). * Factorize code to convert a method to a classmethod (__init_subclass__ and __class_getitem__). * Add braces to respect PEP 7. * Move variable declarations where the variables are initialized.
This commit is contained in:
parent
75a06f067b
commit
ecf14e6557
|
@ -4972,10 +4972,12 @@ PyDictKeysObject *
|
||||||
_PyDict_NewKeysForClass(void)
|
_PyDict_NewKeysForClass(void)
|
||||||
{
|
{
|
||||||
PyDictKeysObject *keys = new_keys_object(PyDict_MINSIZE);
|
PyDictKeysObject *keys = new_keys_object(PyDict_MINSIZE);
|
||||||
if (keys == NULL)
|
if (keys == NULL) {
|
||||||
PyErr_Clear();
|
PyErr_Clear();
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
keys->dk_lookup = lookdict_split;
|
keys->dk_lookup = lookdict_split;
|
||||||
|
}
|
||||||
return keys;
|
return keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1161
Objects/typeobject.c
1161
Objects/typeobject.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue