diff --git a/blist/_blist.c b/blist/_blist.c
index 9abfbb4..ab819c5 100644
--- a/blist/_blist.c
+++ b/blist/_blist.c
@@ -6594,7 +6594,7 @@ py_blist_sort(PyBListRoot *self, PyObject *args, PyObject *kwds)
         memset(&saved, 0, offsetof(PyBListRoot, BLIST_FIRST_FIELD));
         memcpy(&saved.BLIST_FIRST_FIELD, &self->BLIST_FIRST_FIELD,
                sizeof(*self) - offsetof(PyBListRoot, BLIST_FIRST_FIELD));
-        Py_TYPE(&saved) = &PyRootBList_Type;
+        Py_SET_TYPE(&saved, &PyRootBList_Type);
         Py_SET_REFCNT(&saved, 1);
 
         if (extra_list != NULL) {
@@ -7381,10 +7381,10 @@ init_blist_types1(void)
         decref_init();
         highest_set_bit_init();
 
-        Py_TYPE(&PyBList_Type) = &PyType_Type;
-        Py_TYPE(&PyRootBList_Type) = &PyType_Type;
-        Py_TYPE(&PyBListIter_Type) = &PyType_Type;
-        Py_TYPE(&PyBListReverseIter_Type) = &PyType_Type;
+        Py_SET_TYPE(&PyBList_Type, &PyType_Type);
+        Py_SET_TYPE(&PyRootBList_Type, &PyType_Type);
+        Py_SET_TYPE(&PyBListIter_Type, &PyType_Type);
+        Py_SET_TYPE(&PyBListReverseIter_Type, &PyType_Type);
 
         Py_INCREF(&PyBList_Type);
         Py_INCREF(&PyRootBList_Type);
