Skip to content

Commit 53114ff

Browse files
authored
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.
1 parent b38601d commit 53114ff

File tree

2 files changed

+274
-154
lines changed

2 files changed

+274
-154
lines changed

Include/internal/pycore_object.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ extern int _Py_CheckSlotResult(
174174
const char *slot_name,
175175
int success);
176176

177+
// PyType_Ready() must be called if _PyType_IsReady() is false.
178+
// See also the Py_TPFLAGS_READY flag.
179+
#define _PyType_IsReady(type) ((type)->tp_dict != NULL)
180+
177181
#ifdef __cplusplus
178182
}
179183
#endif

0 commit comments

Comments
 (0)