summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-04-11 21:57:09 (GMT)
committerGitHub <noreply@github.com>2021-04-11 21:57:09 (GMT)
commit53114ffef1d4facf9aa5545e711abbbda66f672a (patch)
tree5259e5d70dd3c5ca15628bdfe0e011a553e948e6 /Include
parentb38601d49675d90e1ee6faa47f7adaeca992d02d (diff)
downloadcpython-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.h4
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