diff options
author | Victor Stinner <vstinner@python.org> | 2021-04-10 21:15:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-10 21:15:32 (GMT) |
commit | ecf14e6557c6e4f7af9c0d6460d31fe121c22553 (patch) | |
tree | 0a599aea6b7eee6c2118d6f540945f49a4372d6c /Objects/dictobject.c | |
parent | 75a06f067bd0a2687312e5f8e78f9075be76ad3a (diff) | |
download | cpython-ecf14e6557c6e4f7af9c0d6460d31fe121c22553.zip cpython-ecf14e6557c6e4f7af9c0d6460d31fe121c22553.tar.gz cpython-ecf14e6557c6e4f7af9c0d6460d31fe121c22553.tar.bz2 |
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.
Diffstat (limited to 'Objects/dictobject.c')
-rw-r--r-- | Objects/dictobject.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 179cb30..44796a6 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -4972,10 +4972,12 @@ PyDictKeysObject * _PyDict_NewKeysForClass(void) { PyDictKeysObject *keys = new_keys_object(PyDict_MINSIZE); - if (keys == NULL) + if (keys == NULL) { PyErr_Clear(); - else + } + else { keys->dk_lookup = lookdict_split; + } return keys; } |