@@ -391,7 +391,7 @@ StructUnionType_new(PyTypeObject *type, PyObject *args, PyObject *kwds, int isSt
391391 Py_DECREF ((PyObject * )dict );
392392 return NULL ;
393393 }
394- Py_SETREF (result -> tp_dict , (PyObject * )dict );
394+ Py_XSETREF (result -> tp_dict , (PyObject * )dict );
395395 dict -> format = _ctypes_alloc_format_string (NULL , "B" );
396396 if (dict -> format == NULL ) {
397397 Py_DECREF (result );
@@ -870,7 +870,7 @@ PyCPointerType_SetProto(StgDictObject *stgdict, PyObject *proto)
870870 return -1 ;
871871 }
872872 Py_INCREF (proto );
873- Py_SETREF (stgdict -> proto , proto );
873+ Py_XSETREF (stgdict -> proto , proto );
874874 return 0 ;
875875}
876876
@@ -960,7 +960,7 @@ PyCPointerType_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
960960 Py_DECREF ((PyObject * )stgdict );
961961 return NULL ;
962962 }
963- Py_SETREF (result -> tp_dict , (PyObject * )stgdict );
963+ Py_XSETREF (result -> tp_dict , (PyObject * )stgdict );
964964
965965 return (PyObject * )result ;
966966}
@@ -1403,7 +1403,7 @@ PyCArrayType_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
14031403 /* replace the class dict by our updated spam dict */
14041404 if (-1 == PyDict_Update ((PyObject * )stgdict , result -> tp_dict ))
14051405 goto error ;
1406- Py_SETREF (result -> tp_dict , (PyObject * )stgdict ); /* steal the reference */
1406+ Py_XSETREF (result -> tp_dict , (PyObject * )stgdict ); /* steal the reference */
14071407 stgdict = NULL ;
14081408
14091409 /* Special case for character arrays.
@@ -1816,7 +1816,7 @@ static PyObject *CreateSwappedType(PyTypeObject *type, PyObject *args, PyObject
18161816 Py_DECREF ((PyObject * )stgdict );
18171817 return NULL ;
18181818 }
1819- Py_SETREF (result -> tp_dict , (PyObject * )stgdict );
1819+ Py_XSETREF (result -> tp_dict , (PyObject * )stgdict );
18201820
18211821 return (PyObject * )result ;
18221822}
@@ -1944,7 +1944,7 @@ PyCSimpleType_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
19441944 Py_DECREF ((PyObject * )stgdict );
19451945 return NULL ;
19461946 }
1947- Py_SETREF (result -> tp_dict , (PyObject * )stgdict );
1947+ Py_XSETREF (result -> tp_dict , (PyObject * )stgdict );
19481948
19491949 /* Install from_param class methods in ctypes base classes.
19501950 Overrides the PyCSimpleType_from_param generic method.
@@ -2307,7 +2307,7 @@ PyCFuncPtrType_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
23072307 Py_DECREF ((PyObject * )stgdict );
23082308 return NULL ;
23092309 }
2310- Py_SETREF (result -> tp_dict , (PyObject * )stgdict );
2310+ Py_XSETREF (result -> tp_dict , (PyObject * )stgdict );
23112311
23122312 if (-1 == make_funcptrtype_dict (stgdict )) {
23132313 Py_DECREF (result );
@@ -2451,7 +2451,7 @@ KeepRef(CDataObject *target, Py_ssize_t index, PyObject *keep)
24512451 return -1 ;
24522452 }
24532453 if (ob -> b_objects == NULL || !PyDict_CheckExact (ob -> b_objects )) {
2454- Py_SETREF (ob -> b_objects , keep ); /* refcount consumed */
2454+ Py_XSETREF (ob -> b_objects , keep ); /* refcount consumed */
24552455 return 0 ;
24562456 }
24572457 key = unique_key (target , index );
@@ -2955,7 +2955,7 @@ PyCFuncPtr_set_errcheck(PyCFuncPtrObject *self, PyObject *ob)
29552955 return -1 ;
29562956 }
29572957 Py_XINCREF (ob );
2958- Py_SETREF (self -> errcheck , ob );
2958+ Py_XSETREF (self -> errcheck , ob );
29592959 return 0 ;
29602960}
29612961
@@ -2984,8 +2984,8 @@ PyCFuncPtr_set_restype(PyCFuncPtrObject *self, PyObject *ob)
29842984 return -1 ;
29852985 }
29862986 Py_INCREF (ob );
2987- Py_SETREF (self -> restype , ob );
2988- Py_SETREF (self -> checker , PyObject_GetAttrString (ob , "_check_retval_" ));
2987+ Py_XSETREF (self -> restype , ob );
2988+ Py_XSETREF (self -> checker , PyObject_GetAttrString (ob , "_check_retval_" ));
29892989 if (self -> checker == NULL )
29902990 PyErr_Clear ();
29912991 return 0 ;
@@ -3022,9 +3022,9 @@ PyCFuncPtr_set_argtypes(PyCFuncPtrObject *self, PyObject *ob)
30223022 converters = converters_from_argtypes (ob );
30233023 if (!converters )
30243024 return -1 ;
3025- Py_SETREF (self -> converters , converters );
3025+ Py_XSETREF (self -> converters , converters );
30263026 Py_INCREF (ob );
3027- Py_SETREF (self -> argtypes , ob );
3027+ Py_XSETREF (self -> argtypes , ob );
30283028 }
30293029 return 0 ;
30303030}
@@ -5152,7 +5152,7 @@ comerror_init(PyObject *self, PyObject *args, PyObject *kwds)
51525152
51535153 bself = (PyBaseExceptionObject * )self ;
51545154 Py_INCREF (args );
5155- Py_SETREF (bself -> args , args );
5155+ Py_XSETREF (bself -> args , args );
51565156
51575157 return 0 ;
51585158}
0 commit comments