|
|
|
@ -391,8 +391,7 @@ StructUnionType_new(PyTypeObject *type, PyObject *args, PyObject *kwds, int isSt |
|
|
|
Py_DECREF((PyObject *)dict); |
|
|
|
return NULL; |
|
|
|
} |
|
|
|
Py_DECREF(result->tp_dict); |
|
|
|
result->tp_dict = (PyObject *)dict; |
|
|
|
Py_SETREF(result->tp_dict, (PyObject *)dict); |
|
|
|
dict->format = _ctypes_alloc_format_string(NULL, "B"); |
|
|
|
if (dict->format == NULL) { |
|
|
|
Py_DECREF(result); |
|
|
|
@ -871,8 +870,7 @@ PyCPointerType_SetProto(StgDictObject *stgdict, PyObject *proto) |
|
|
|
return -1; |
|
|
|
} |
|
|
|
Py_INCREF(proto); |
|
|
|
Py_XDECREF(stgdict->proto); |
|
|
|
stgdict->proto = proto; |
|
|
|
Py_SETREF(stgdict->proto, proto); |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
@ -962,8 +960,7 @@ PyCPointerType_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
|
|
|
Py_DECREF((PyObject *)stgdict); |
|
|
|
return NULL; |
|
|
|
} |
|
|
|
Py_DECREF(result->tp_dict); |
|
|
|
result->tp_dict = (PyObject *)stgdict; |
|
|
|
Py_SETREF(result->tp_dict, (PyObject *)stgdict); |
|
|
|
|
|
|
|
return (PyObject *)result; |
|
|
|
} |
|
|
|
@ -1406,8 +1403,7 @@ PyCArrayType_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
|
|
|
/* replace the class dict by our updated spam dict */ |
|
|
|
if (-1 == PyDict_Update((PyObject *)stgdict, result->tp_dict)) |
|
|
|
goto error; |
|
|
|
Py_DECREF(result->tp_dict); |
|
|
|
result->tp_dict = (PyObject *)stgdict; /* steal the reference */ |
|
|
|
Py_SETREF(result->tp_dict, (PyObject *)stgdict); /* steal the reference */ |
|
|
|
stgdict = NULL; |
|
|
|
|
|
|
|
/* Special case for character arrays. |
|
|
|
@ -1820,8 +1816,7 @@ static PyObject *CreateSwappedType(PyTypeObject *type, PyObject *args, PyObject |
|
|
|
Py_DECREF((PyObject *)stgdict); |
|
|
|
return NULL; |
|
|
|
} |
|
|
|
Py_DECREF(result->tp_dict); |
|
|
|
result->tp_dict = (PyObject *)stgdict; |
|
|
|
Py_SETREF(result->tp_dict, (PyObject *)stgdict); |
|
|
|
|
|
|
|
return (PyObject *)result; |
|
|
|
} |
|
|
|
@ -1949,8 +1944,7 @@ PyCSimpleType_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
|
|
|
Py_DECREF((PyObject *)stgdict); |
|
|
|
return NULL; |
|
|
|
} |
|
|
|
Py_DECREF(result->tp_dict); |
|
|
|
result->tp_dict = (PyObject *)stgdict; |
|
|
|
Py_SETREF(result->tp_dict, (PyObject *)stgdict); |
|
|
|
|
|
|
|
/* Install from_param class methods in ctypes base classes. |
|
|
|
Overrides the PyCSimpleType_from_param generic method. |
|
|
|
@ -2313,8 +2307,7 @@ PyCFuncPtrType_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
|
|
|
Py_DECREF((PyObject *)stgdict); |
|
|
|
return NULL; |
|
|
|
} |
|
|
|
Py_DECREF(result->tp_dict); |
|
|
|
result->tp_dict = (PyObject *)stgdict; |
|
|
|
Py_SETREF(result->tp_dict, (PyObject *)stgdict); |
|
|
|
|
|
|
|
if (-1 == make_funcptrtype_dict(stgdict)) { |
|
|
|
Py_DECREF(result); |
|
|
|
@ -2458,8 +2451,7 @@ KeepRef(CDataObject *target, Py_ssize_t index, PyObject *keep) |
|
|
|
return -1; |
|
|
|
} |
|
|
|
if (ob->b_objects == NULL || !PyDict_CheckExact(ob->b_objects)) { |
|
|
|
Py_XDECREF(ob->b_objects); |
|
|
|
ob->b_objects = keep; /* refcount consumed */ |
|
|
|
Py_SETREF(ob->b_objects, keep); /* refcount consumed */ |
|
|
|
return 0; |
|
|
|
} |
|
|
|
key = unique_key(target, index); |
|
|
|
@ -2962,9 +2954,8 @@ PyCFuncPtr_set_errcheck(PyCFuncPtrObject *self, PyObject *ob) |
|
|
|
"the errcheck attribute must be callable"); |
|
|
|
return -1; |
|
|
|
} |
|
|
|
Py_XDECREF(self->errcheck); |
|
|
|
Py_XINCREF(ob); |
|
|
|
self->errcheck = ob; |
|
|
|
Py_SETREF(self->errcheck, ob); |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
@ -2993,9 +2984,8 @@ PyCFuncPtr_set_restype(PyCFuncPtrObject *self, PyObject *ob) |
|
|
|
return -1; |
|
|
|
} |
|
|
|
Py_XDECREF(self->checker); |
|
|
|
Py_XDECREF(self->restype); |
|
|
|
Py_INCREF(ob); |
|
|
|
self->restype = ob; |
|
|
|
Py_SETREF(self->restype, ob); |
|
|
|
self->checker = PyObject_GetAttrString(ob, "_check_retval_"); |
|
|
|
if (self->checker == NULL) |
|
|
|
PyErr_Clear(); |
|
|
|
@ -3033,11 +3023,9 @@ PyCFuncPtr_set_argtypes(PyCFuncPtrObject *self, PyObject *ob) |
|
|
|
converters = converters_from_argtypes(ob); |
|
|
|
if (!converters) |
|
|
|
return -1; |
|
|
|
Py_XDECREF(self->converters); |
|
|
|
self->converters = converters; |
|
|
|
Py_XDECREF(self->argtypes); |
|
|
|
Py_SETREF(self->converters, converters); |
|
|
|
Py_INCREF(ob); |
|
|
|
self->argtypes = ob; |
|
|
|
Py_SETREF(self->argtypes, ob); |
|
|
|
} |
|
|
|
return 0; |
|
|
|
} |
|
|
|
@ -5164,9 +5152,8 @@ comerror_init(PyObject *self, PyObject *args, PyObject *kwds) |
|
|
|
return -1; |
|
|
|
|
|
|
|
bself = (PyBaseExceptionObject *)self; |
|
|
|
Py_DECREF(bself->args); |
|
|
|
bself->args = args; |
|
|
|
Py_INCREF(bself->args); |
|
|
|
Py_INCREF(args); |
|
|
|
Py_SETREF(bself->args, args); |
|
|
|
|
|
|
|
return 0; |
|
|
|
} |
|
|
|
|