From d2ec81a8c99796b51fb8c49b77a7fe369863226f Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 7 Feb 2020 09:17:07 +0100 Subject: bpo-39573: Add Py_SET_TYPE() function (GH-18394) Add Py_SET_TYPE() function to set the type of an object. --- Modules/itertoolsmodule.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Modules/itertoolsmodule.c') diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c index 0cb472966d..0dafb65c28 100644 --- a/Modules/itertoolsmodule.c +++ b/Modules/itertoolsmodule.c @@ -4750,14 +4750,16 @@ PyInit_itertools(void) NULL }; - Py_TYPE(&teedataobject_type) = &PyType_Type; + Py_SET_TYPE(&teedataobject_type, &PyType_Type); m = PyModule_Create(&itertoolsmodule); - if (m == NULL) + if (m == NULL) { return NULL; + } for (i=0 ; typelist[i] != NULL ; i++) { - if (PyType_Ready(typelist[i]) < 0) + if (PyType_Ready(typelist[i]) < 0) { return NULL; + } name = _PyType_Name(typelist[i]); Py_INCREF(typelist[i]); PyModule_AddObject(m, name, (PyObject *)typelist[i]); -- cgit v1.2.1