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/md5module.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Modules/md5module.c') diff --git a/Modules/md5module.c b/Modules/md5module.c index f2c2d32cbe..d783ae5a76 100644 --- a/Modules/md5module.c +++ b/Modules/md5module.c @@ -572,13 +572,15 @@ PyInit__md5(void) { PyObject *m; - Py_TYPE(&MD5type) = &PyType_Type; - if (PyType_Ready(&MD5type) < 0) + Py_SET_TYPE(&MD5type, &PyType_Type); + if (PyType_Ready(&MD5type) < 0) { return NULL; + } m = PyModule_Create(&_md5module); - if (m == NULL) + if (m == NULL) { return NULL; + } Py_INCREF((PyObject *)&MD5type); PyModule_AddObject(m, "MD5Type", (PyObject *)&MD5type); -- cgit v1.2.1