summaryrefslogtreecommitdiff
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/floatobject.c2
-rw-r--r--Objects/moduleobject.c2
-rw-r--r--Objects/object.c2
-rw-r--r--Objects/typeobject.c10
-rw-r--r--Objects/weakrefobject.c10
5 files changed, 15 insertions, 11 deletions
diff --git a/Objects/floatobject.c b/Objects/floatobject.c
index 26e238cf05..dfc5b196f1 100644
--- a/Objects/floatobject.c
+++ b/Objects/floatobject.c
@@ -221,7 +221,7 @@ float_dealloc(PyFloatObject *op)
return;
}
numfree++;
- Py_TYPE(op) = (struct _typeobject *)free_list;
+ Py_SET_TYPE(op, (PyTypeObject *)free_list);
free_list = op;
}
else
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c
index da329b4fba..0a593261c4 100644
--- a/Objects/moduleobject.c
+++ b/Objects/moduleobject.c
@@ -52,7 +52,7 @@ PyModuleDef_Init(struct PyModuleDef* def)
if (def->m_base.m_index == 0) {
max_module_number++;
Py_SET_REFCNT(def, 1);
- Py_TYPE(def) = &PyModuleDef_Type;
+ Py_SET_TYPE(def, &PyModuleDef_Type);
def->m_base.m_index = max_module_number;
}
return (PyObject*)def;
diff --git a/Objects/object.c b/Objects/object.c
index 5806542488..503fb86780 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -144,7 +144,7 @@ PyObject_Init(PyObject *op, PyTypeObject *tp)
return PyErr_NoMemory();
}
- Py_TYPE(op) = tp;
+ Py_SET_TYPE(op, tp);
if (PyType_GetFlags(tp) & Py_TPFLAGS_HEAPTYPE) {
Py_INCREF(tp);
}
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 5b8d5a228e..e6a84b017a 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -4097,9 +4097,10 @@ object_set_class(PyObject *self, PyObject *value, void *closure)
}
if (compatible_for_assignment(oldto, newto, "__class__")) {
- if (newto->tp_flags & Py_TPFLAGS_HEAPTYPE)
+ if (newto->tp_flags & Py_TPFLAGS_HEAPTYPE) {
Py_INCREF(newto);
- Py_TYPE(self) = newto;
+ }
+ Py_SET_TYPE(self, newto);
if (oldto->tp_flags & Py_TPFLAGS_HEAPTYPE)
Py_DECREF(oldto);
return 0;
@@ -5334,8 +5335,9 @@ PyType_Ready(PyTypeObject *type)
NULL when type is &PyBaseObject_Type, and we know its ob_type is
not NULL (it's initialized to &PyType_Type). But coverity doesn't
know that. */
- if (Py_TYPE(type) == NULL && base != NULL)
- Py_TYPE(type) = Py_TYPE(base);
+ if (Py_TYPE(type) == NULL && base != NULL) {
+ Py_SET_TYPE(type, Py_TYPE(base));
+ }
/* Initialize tp_bases */
bases = type->tp_bases;
diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c
index d104b646f0..18c737e7e4 100644
--- a/Objects/weakrefobject.c
+++ b/Objects/weakrefobject.c
@@ -882,10 +882,12 @@ PyWeakref_NewProxy(PyObject *ob, PyObject *callback)
if (result != NULL) {
PyWeakReference *prev;
- if (PyCallable_Check(ob))
- Py_TYPE(result) = &_PyWeakref_CallableProxyType;
- else
- Py_TYPE(result) = &_PyWeakref_ProxyType;
+ if (PyCallable_Check(ob)) {
+ Py_SET_TYPE(result, &_PyWeakref_CallableProxyType);
+ }
+ else {
+ Py_SET_TYPE(result, &_PyWeakref_ProxyType);
+ }
get_basic_refs(*list, &ref, &proxy);
if (callback == NULL) {
if (proxy != NULL) {