bpo-43770: Refactor PyType_Ready() function (GH-25336)

* Split PyType_Ready() into sub-functions.
* type_ready_mro() now checks if bases are static types earlier.
* Check tp_name earlier, in type_ready_checks().
* Add _PyType_IsReady() macro to check if a type is ready.
This commit is contained in:
Victor Stinner 2021-04-11 23:57:09 +02:00 committed by GitHub
parent b38601d496
commit 53114ffef1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 280 additions and 160 deletions

View file

@ -174,6 +174,10 @@ extern int _Py_CheckSlotResult(
const char *slot_name,
int success);
// PyType_Ready() must be called if _PyType_IsReady() is false.
// See also the Py_TPFLAGS_READY flag.
#define _PyType_IsReady(type) ((type)->tp_dict != NULL)
#ifdef __cplusplus
}
#endif