Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ecf14e6

Browse files
authored
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.
1 parent 75a06f0 commit ecf14e6

2 files changed

Lines changed: 736 additions & 397 deletions

File tree

Objects/dictobject.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4972,10 +4972,12 @@ PyDictKeysObject *
49724972
_PyDict_NewKeysForClass(void)
49734973
{
49744974
PyDictKeysObject *keys = new_keys_object(PyDict_MINSIZE);
4975-
if (keys == NULL)
4975+
if (keys == NULL) {
49764976
PyErr_Clear();
4977-
else
4977+
}
4978+
else {
49784979
keys->dk_lookup = lookdict_split;
4980+
}
49794981
return keys;
49804982
}
49814983

0 commit comments

Comments
 (0)