diff options
author | Victor Stinner <vstinner@python.org> | 2020-02-07 09:17:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-07 09:17:07 +0100 |
commit | d2ec81a8c99796b51fb8c49b77a7fe369863226f (patch) | |
tree | d88e7cbe89f65366d5591338fbe59a71192950db /Modules/itertoolsmodule.c | |
parent | daa9756cb6395323d6f291efe5c7d7fdc6b2e9d8 (diff) | |
download | cpython-git-d2ec81a8c99796b51fb8c49b77a7fe369863226f.tar.gz |
bpo-39573: Add Py_SET_TYPE() function (GH-18394)
Add Py_SET_TYPE() function to set the type of an object.
Diffstat (limited to 'Modules/itertoolsmodule.c')
-rw-r--r-- | Modules/itertoolsmodule.c | 8 |
1 files changed, 5 insertions, 3 deletions
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]); |