bpo-39573: Add Py_SET_TYPE() function (GH-18394)

Add Py_SET_TYPE() function to set the type of an object.
diff --git a/Modules/sha1module.c b/Modules/sha1module.c
index 4d191c3..e066b880 100644
--- a/Modules/sha1module.c
+++ b/Modules/sha1module.c
@@ -549,13 +549,15 @@
 {
     PyObject *m;
 
-    Py_TYPE(&SHA1type) = &PyType_Type;
-    if (PyType_Ready(&SHA1type) < 0)
+    Py_SET_TYPE(&SHA1type, &PyType_Type);
+    if (PyType_Ready(&SHA1type) < 0) {
         return NULL;
+    }
 
     m = PyModule_Create(&_sha1module);
-    if (m == NULL)
+    if (m == NULL) {
         return NULL;
+    }
 
     Py_INCREF((PyObject *)&SHA1type);
     PyModule_AddObject(m, "SHA1Type", (PyObject *)&SHA1type);