diff options
author | Victor Stinner <vstinner@python.org> | 2021-04-11 21:57:09 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-11 21:57:09 (GMT) |
commit | 53114ffef1d4facf9aa5545e711abbbda66f672a (patch) | |
tree | 5259e5d70dd3c5ca15628bdfe0e011a553e948e6 /Include | |
parent | b38601d49675d90e1ee6faa47f7adaeca992d02d (diff) | |
download | cpython-53114ffef1d4facf9aa5545e711abbbda66f672a.zip cpython-53114ffef1d4facf9aa5545e711abbbda66f672a.tar.gz cpython-53114ffef1d4facf9aa5545e711abbbda66f672a.tar.bz2 |
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.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/internal/pycore_object.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Include/internal/pycore_object.h b/Include/internal/pycore_object.h index 79c1c44..9dfc8c6 100644 --- a/Include/internal/pycore_object.h +++ b/Include/internal/pycore_object.h @@ -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 |