]> granicus.if.org Git - python/commitdiff
Issue #22570: Renamed Py_SETREF to Py_XSETREF.
authorSerhiy Storchaka <storchaka@gmail.com>
Wed, 6 Apr 2016 06:51:18 +0000 (09:51 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Wed, 6 Apr 2016 06:51:18 +0000 (09:51 +0300)
33 files changed:
Include/object.h
Modules/_bsddb.c
Modules/_csv.c
Modules/_ctypes/_ctypes.c
Modules/_curses_panel.c
Modules/_elementtree.c
Modules/_functoolsmodule.c
Modules/_io/bufferedio.c
Modules/_io/textio.c
Modules/_json.c
Modules/_sqlite/connection.c
Modules/_sqlite/cursor.c
Modules/_sre.c
Modules/_ssl.c
Modules/_struct.c
Modules/bz2module.c
Modules/cPickle.c
Modules/cdmodule.c
Modules/itertoolsmodule.c
Modules/signalmodule.c
Modules/zlibmodule.c
Objects/descrobject.c
Objects/exceptions.c
Objects/fileobject.c
Objects/frameobject.c
Objects/funcobject.c
Objects/stringobject.c
Objects/typeobject.c
Objects/unicodeobject.c
Python/_warnings.c
Python/ceval.c
Python/compile.c
Python/errors.c

index 8fe202dd3fd96ca6a087577f282d9a8e05777960..6481a5b65f16ed66e70c082a9e95be7e208dc251 100644 (file)
@@ -833,14 +833,14 @@ PyAPI_FUNC(void) _Py_AddToAllObjects(PyObject *, int force);
  *
  * The safe way is:
  *
- *      Py_SETREF(op, op2);
+ *      Py_XSETREF(op, op2);
  *
  * That arranges to set `op` to `op2` _before_ decref'ing, so that any code
  * triggered as a side-effect of `op` getting torn down no longer believes
  * `op` points to a valid object.
  */
 
-#define Py_SETREF(op, op2)                      \
+#define Py_XSETREF(op, op2)                     \
     do {                                        \
         PyObject *_py_tmp = (PyObject *)(op);   \
         (op) = (op2);                           \
index 9cebaf4dc46f8a1f20bd46bb1491dccb2ffde5d6..5fd52d99fa65b10c253f35d6f2bf983b8b670408 100644 (file)
@@ -1608,7 +1608,7 @@ DB_associate(DBObject* self, PyObject* args, PyObject* kwargs)
 
     /* Save a reference to the callback in the secondary DB. */
     Py_XINCREF(callback);
-    Py_SETREF(secondaryDB->associateCallback, callback);
+    Py_XSETREF(secondaryDB->associateCallback, callback);
     secondaryDB->primaryDBType = _DB_get_type(self);
 
     /* PyEval_InitThreads is called here due to a quirk in python 1.5
@@ -2498,7 +2498,7 @@ DB_set_private(DBObject* self, PyObject* private_obj)
 {
     /* We can set the private field even if db is closed */
     Py_INCREF(private_obj);
-    Py_SETREF(self->private_obj, private_obj);
+    Py_XSETREF(self->private_obj, private_obj);
     RETURN_NONE();
 }
 
@@ -6997,7 +6997,7 @@ DBEnv_set_private(DBEnvObject* self, PyObject* private_obj)
 {
     /* We can set the private field even if dbenv is closed */
     Py_INCREF(private_obj);
-    Py_SETREF(self->private_obj, private_obj);
+    Py_XSETREF(self->private_obj, private_obj);
     RETURN_NONE();
 }
 
@@ -7251,7 +7251,7 @@ DBEnv_set_event_notify(DBEnvObject* self, PyObject* notifyFunc)
     }
 
     Py_INCREF(notifyFunc);
-    Py_SETREF(self->event_notifyCallback, notifyFunc);
+    Py_XSETREF(self->event_notifyCallback, notifyFunc);
 
     /* This is to workaround a problem with un-initialized threads (see
        comment in DB_associate) */
@@ -7410,7 +7410,7 @@ DBEnv_rep_set_transport(DBEnvObject* self, PyObject* args)
     RETURN_IF_ERR();
 
     Py_INCREF(rep_transport);
-    Py_SETREF(self->rep_transport, rep_transport);
+    Py_XSETREF(self->rep_transport, rep_transport);
     RETURN_NONE();
 }
 
index 9271413863b2ac401b00f43a519db057fa4488ed..e78ac957f84cf1f954360b52612764f54850f565 100644 (file)
@@ -277,7 +277,7 @@ _set_str(const char *name, PyObject **target, PyObject *src, const char *dflt)
         }
         else {
             Py_INCREF(src);
-            Py_SETREF(*target, src);
+            Py_XSETREF(*target, src);
         }
     }
     return 0;
@@ -769,7 +769,7 @@ parse_process_char(ReaderObj *self, char c)
 static int
 parse_reset(ReaderObj *self)
 {
-    Py_SETREF(self->fields, PyList_New(0));
+    Py_XSETREF(self->fields, PyList_New(0));
     if (self->fields == NULL)
         return -1;
     self->field_len = 0;
index 7d66d117f97d765d2b991f3951a250cf1f9c748b..7f66d6a85f997f3fe3b57026fe6e319e3c7ad778 100644 (file)
@@ -424,7 +424,7 @@ StructUnionType_new(PyTypeObject *type, PyObject *args, PyObject *kwds, int isSt
         Py_DECREF((PyObject *)dict);
         return NULL;
     }
-    Py_SETREF(result->tp_dict, (PyObject *)dict);
+    Py_XSETREF(result->tp_dict, (PyObject *)dict);
     dict->format = _ctypes_alloc_format_string(NULL, "B");
     if (dict->format == NULL) {
         Py_DECREF(result);
@@ -902,7 +902,7 @@ PyCPointerType_SetProto(StgDictObject *stgdict, PyObject *proto)
         return -1;
     }
     Py_INCREF(proto);
-    Py_SETREF(stgdict->proto, proto);
+    Py_XSETREF(stgdict->proto, proto);
     return 0;
 }
 
@@ -992,7 +992,7 @@ PyCPointerType_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
         Py_DECREF((PyObject *)stgdict);
         return NULL;
     }
-    Py_SETREF(result->tp_dict, (PyObject *)stgdict);
+    Py_XSETREF(result->tp_dict, (PyObject *)stgdict);
 
     return (PyObject *)result;
 }
@@ -1457,7 +1457,7 @@ PyCArrayType_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
         Py_DECREF((PyObject *)stgdict);
         return NULL;
     }
-    Py_SETREF(result->tp_dict, (PyObject *)stgdict);
+    Py_XSETREF(result->tp_dict, (PyObject *)stgdict);
 
     /* Special case for character arrays.
        A permanent annoyance: char arrays are also strings!
@@ -1880,7 +1880,7 @@ static PyObject *CreateSwappedType(PyTypeObject *type, PyObject *args, PyObject
         Py_DECREF((PyObject *)stgdict);
         return NULL;
     }
-    Py_SETREF(result->tp_dict, (PyObject *)stgdict);
+    Py_XSETREF(result->tp_dict, (PyObject *)stgdict);
 
     return (PyObject *)result;
 }
@@ -2388,7 +2388,7 @@ PyCFuncPtrType_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
         Py_DECREF((PyObject *)stgdict);
         return NULL;
     }
-    Py_SETREF(result->tp_dict, (PyObject *)stgdict);
+    Py_XSETREF(result->tp_dict, (PyObject *)stgdict);
 
     if (-1 == make_funcptrtype_dict(stgdict)) {
         Py_DECREF(result);
@@ -2530,7 +2530,7 @@ KeepRef(CDataObject *target, Py_ssize_t index, PyObject *keep)
     }
     ob = PyCData_GetContainer(target);
     if (ob->b_objects == NULL || !PyDict_CheckExact(ob->b_objects)) {
-        Py_SETREF(ob->b_objects, keep); /* refcount consumed */
+        Py_XSETREF(ob->b_objects, keep); /* refcount consumed */
         return 0;
     }
     key = unique_key(target, index);
@@ -3053,7 +3053,7 @@ PyCFuncPtr_set_errcheck(PyCFuncPtrObject *self, PyObject *ob)
         return -1;
     }
     Py_XINCREF(ob);
-    Py_SETREF(self->errcheck, ob);
+    Py_XSETREF(self->errcheck, ob);
     return 0;
 }
 
@@ -3082,8 +3082,8 @@ PyCFuncPtr_set_restype(PyCFuncPtrObject *self, PyObject *ob)
         return -1;
     }
     Py_INCREF(ob);
-    Py_SETREF(self->restype, ob);
-    Py_SETREF(self->checker, PyObject_GetAttrString(ob, "_check_retval_"));
+    Py_XSETREF(self->restype, ob);
+    Py_XSETREF(self->checker, PyObject_GetAttrString(ob, "_check_retval_"));
     if (self->checker == NULL)
         PyErr_Clear();
     return 0;
@@ -3120,9 +3120,9 @@ PyCFuncPtr_set_argtypes(PyCFuncPtrObject *self, PyObject *ob)
         converters = converters_from_argtypes(ob);
         if (!converters)
             return -1;
-        Py_SETREF(self->converters, converters);
+        Py_XSETREF(self->converters, converters);
         Py_INCREF(ob);
-        Py_SETREF(self->argtypes, ob);
+        Py_XSETREF(self->argtypes, ob);
     }
     return 0;
 }
index d61281ed06bf083a3319785cef718693f8b3a997..dbc0f5332a7efd709e88b48db1d15012694a7329 100644 (file)
@@ -284,7 +284,7 @@ PyCursesPanel_replace_panel(PyCursesPanelObject *self, PyObject *args)
         return NULL;
     }
     Py_INCREF(temp);
-    Py_SETREF(po->wo, temp);
+    Py_XSETREF(po->wo, temp);
     Py_INCREF(Py_None);
     return Py_None;
 }
index a035c5792026deb7091b71429aff61564e073460..793d4c73c631d5833bedb0c53913ef18f5c65500 100644 (file)
@@ -1574,7 +1574,7 @@ element_setattr(ElementObject* self, const char* name, PyObject* value)
 
     if (strcmp(name, "tag") == 0) {
         Py_INCREF(value);
-        Py_SETREF(self->tag, value);
+        Py_XSETREF(self->tag, value);
     } else if (strcmp(name, "text") == 0) {
         Py_DECREF(JOIN_OBJ(self->text));
         self->text = value;
@@ -1587,7 +1587,7 @@ element_setattr(ElementObject* self, const char* name, PyObject* value)
         if (!self->extra)
             element_new_extra(self, NULL);
         Py_INCREF(value);
-        Py_SETREF(self->extra->attrib, value);
+        Py_XSETREF(self->extra->attrib, value);
     } else {
         PyErr_SetString(PyExc_AttributeError, name);
         return -1;
@@ -1799,10 +1799,10 @@ treebuilder_handle_start(TreeBuilderObject* self, PyObject* tag,
     self->index++;
 
     Py_INCREF(node);
-    Py_SETREF(self->this, (ElementObject*) node);
+    Py_XSETREF(self->this, (ElementObject*) node);
 
     Py_INCREF(node);
-    Py_SETREF(self->last, (ElementObject*) node);
+    Py_XSETREF(self->last, (ElementObject*) node);
 
     if (treebuilder_append_event(self, self->start_event_obj, node) < 0)
         goto error;
@@ -2744,7 +2744,7 @@ xmlparser_setevents(XMLParserObject* self, PyObject* args)
     target = (TreeBuilderObject*) self->target;
 
     Py_INCREF(events);
-    Py_SETREF(target->events, events);
+    Py_XSETREF(target->events, events);
 
     /* clear out existing events */
     Py_CLEAR(target->start_event_obj);
@@ -2769,18 +2769,18 @@ xmlparser_setevents(XMLParserObject* self, PyObject* args)
         Py_INCREF(item);
         event = PyString_AS_STRING(item);
         if (strcmp(event, "start") == 0) {
-            Py_SETREF(target->start_event_obj, item);
+            Py_XSETREF(target->start_event_obj, item);
         } else if (strcmp(event, "end") == 0) {
-            Py_SETREF(target->end_event_obj, item);
+            Py_XSETREF(target->end_event_obj, item);
         } else if (strcmp(event, "start-ns") == 0) {
-            Py_SETREF(target->start_ns_event_obj, item);
+            Py_XSETREF(target->start_ns_event_obj, item);
             EXPAT(SetNamespaceDeclHandler)(
                 self->parser,
                 (XML_StartNamespaceDeclHandler) expat_start_ns_handler,
                 (XML_EndNamespaceDeclHandler) expat_end_ns_handler
                 );
         } else if (strcmp(event, "end-ns") == 0) {
-            Py_SETREF(target->end_ns_event_obj, item);
+            Py_XSETREF(target->end_ns_event_obj, item);
             EXPAT(SetNamespaceDeclHandler)(
                 self->parser,
                 (XML_StartNamespaceDeclHandler) expat_start_ns_handler,
index 2ad556d93a3b9fb0923293d03d918e1da8195fe7..b2cfd75394459cbcd3b5a0049480905dd60236ff 100644 (file)
@@ -320,10 +320,10 @@ partial_setstate(partialobject *pto, PyObject *state)
     else
         Py_INCREF(dict);
 
-    Py_SETREF(pto->fn, fn);
-    Py_SETREF(pto->args, fnargs);
-    Py_SETREF(pto->kw, kw);
-    Py_SETREF(pto->dict, dict);
+    Py_XSETREF(pto->fn, fn);
+    Py_XSETREF(pto->args, fnargs);
+    Py_XSETREF(pto->kw, kw);
+    Py_XSETREF(pto->dict, dict);
     Py_RETURN_NONE;
 }
 
index 9b2e5b26f17bb749f31a5f0ba33c919b4d89d43a..600bf8adb4338ae6dc9e2de061dec347440ae6d2 100644 (file)
@@ -1028,7 +1028,7 @@ found:
         Py_CLEAR(res);
         goto end;
     }
-    Py_SETREF(res, _PyBytes_Join(_PyIO_empty_bytes, chunks));
+    Py_XSETREF(res, _PyBytes_Join(_PyIO_empty_bytes, chunks));
 
 end:
     LEAVE_BUFFERED(self)
@@ -1264,7 +1264,7 @@ bufferedreader_init(buffered *self, PyObject *args, PyObject *kwds)
         return -1;
 
     Py_INCREF(raw);
-    Py_SETREF(self->raw, raw);
+    Py_XSETREF(self->raw, raw);
     self->buffer_size = buffer_size;
     self->readable = 1;
     self->writable = 0;
@@ -1686,7 +1686,7 @@ bufferedwriter_init(buffered *self, PyObject *args, PyObject *kwds)
         return -1;
 
     Py_INCREF(raw);
-    Py_SETREF(self->raw, raw);
+    Py_XSETREF(self->raw, raw);
     self->readable = 0;
     self->writable = 1;
 
@@ -2342,7 +2342,7 @@ bufferedrandom_init(buffered *self, PyObject *args, PyObject *kwds)
         return -1;
 
     Py_INCREF(raw);
-    Py_SETREF(self->raw, raw);
+    Py_XSETREF(self->raw, raw);
     self->buffer_size = buffer_size;
     self->readable = 1;
     self->writable = 1;
index bb4c5efae8b5c353444befbf356cd7944cce4974..38bb0d8eff83f9983a91e9b92562017d9e2f3ddc 100644 (file)
@@ -966,7 +966,7 @@ textiowrapper_init(textio *self, PyObject *args, PyObject *kwds)
                 "Oi", self->decoder, (int)self->readtranslate);
             if (incrementalDecoder == NULL)
                 goto error;
-            Py_SETREF(self->decoder, incrementalDecoder);
+            Py_XSETREF(self->decoder, incrementalDecoder);
         }
     }
 
@@ -1346,7 +1346,7 @@ textiowrapper_write(textio *self, PyObject *args)
 static void
 textiowrapper_set_decoded_chars(textio *self, PyObject *chars)
 {
-    Py_SETREF(self->decoded_chars, chars);
+    Py_XSETREF(self->decoded_chars, chars);
     self->decoded_chars_used = 0;
 }
 
@@ -1475,7 +1475,7 @@ textiowrapper_read_chunk(textio *self)
             goto fail;
         }
         Py_DECREF(dec_buffer);
-        Py_SETREF(self->snapshot, Py_BuildValue("NN", dec_flags, next_input));
+        Py_XSETREF(self->snapshot, Py_BuildValue("NN", dec_flags, next_input));
     }
     Py_DECREF(input_chunk);
 
@@ -1575,7 +1575,7 @@ textiowrapper_read(textio *self, PyObject *args)
         if (chunks != NULL) {
             if (result != NULL && PyList_Append(chunks, result) < 0)
                 goto fail;
-            Py_SETREF(result, PyUnicode_Join(_PyIO_empty_str, chunks));
+            Py_XSETREF(result, PyUnicode_Join(_PyIO_empty_str, chunks));
             if (result == NULL)
                 goto fail;
             Py_CLEAR(chunks);
@@ -1832,7 +1832,7 @@ _textiowrapper_readline(textio *self, Py_ssize_t limit)
     if (chunks != NULL) {
         if (line != NULL && PyList_Append(chunks, line) < 0)
             goto error;
-        Py_SETREF(line, PyUnicode_Join(_PyIO_empty_str, chunks));
+        Py_XSETREF(line, PyUnicode_Join(_PyIO_empty_str, chunks));
         if (line == NULL)
             goto error;
         Py_DECREF(chunks);
index fede6b14a17cfaf1e4e75d13bcf5234947887da8..9c8f66ce110b333db755debedc0c6cfa553734ac 100644 (file)
@@ -1717,7 +1717,7 @@ scanner_init(PyObject *self, PyObject *args, PyObject *kwds)
     }
     else if (PyUnicode_Check(s->encoding)) {
         PyObject *tmp = PyUnicode_AsEncodedString(s->encoding, NULL, NULL);
-        Py_SETREF(s->encoding, tmp);
+        Py_XSETREF(s->encoding, tmp);
     }
     if (s->encoding == NULL)
         goto bail;
index c67d10c2f3b00c3c3f0382223597912e59a2dd83..9ced405acafc921c332c04a74c4c8ecb4a00051b 100644 (file)
@@ -228,7 +228,7 @@ void pysqlite_flush_statement_cache(pysqlite_Connection* self)
         node = node->next;
     }
 
-    Py_SETREF(self->statement_cache,
+    Py_XSETREF(self->statement_cache,
               (pysqlite_Cache *)PyObject_CallFunction((PyObject *)&pysqlite_CacheType, "O", self));
     Py_DECREF(self);
     self->statement_cache->decref_factory = 0;
@@ -347,7 +347,7 @@ PyObject* pysqlite_connection_cursor(pysqlite_Connection* self, PyObject* args,
 
     if (cursor && self->row_factory != Py_None) {
         Py_INCREF(self->row_factory);
-        Py_SETREF(((pysqlite_Cursor *)cursor)->row_factory, self->row_factory);
+        Py_XSETREF(((pysqlite_Cursor *)cursor)->row_factory, self->row_factory);
     }
 
     return cursor;
@@ -815,7 +815,7 @@ static void _pysqlite_drop_unused_statement_references(pysqlite_Connection* self
         }
     }
 
-    Py_SETREF(self->statements, new_list);
+    Py_XSETREF(self->statements, new_list);
 }
 
 static void _pysqlite_drop_unused_cursor_references(pysqlite_Connection* self)
@@ -846,7 +846,7 @@ static void _pysqlite_drop_unused_cursor_references(pysqlite_Connection* self)
         }
     }
 
-    Py_SETREF(self->cursors, new_list);
+    Py_XSETREF(self->cursors, new_list);
 }
 
 PyObject* pysqlite_connection_create_function(pysqlite_Connection* self, PyObject* args, PyObject* kwargs)
index 3d5b8f396ae6c64b62b003e2f6c59fb6b47a2a6b..b3ec8f253c904e146b7c2d8f1537e8ea257956b6 100644 (file)
@@ -172,7 +172,7 @@ int pysqlite_build_row_cast_map(pysqlite_Cursor* self)
         return 0;
     }
 
-    Py_SETREF(self->row_cast_map, PyList_New(0));
+    Py_XSETREF(self->row_cast_map, PyList_New(0));
 
     for (i = 0; i < sqlite3_column_count(self->statement->st); i++) {
         converter = NULL;
@@ -544,7 +544,7 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject*
 
     /* reset description and rowcount */
     Py_INCREF(Py_None);
-    Py_SETREF(self->description, Py_None);
+    Py_XSETREF(self->description, Py_None);
     self->rowcount = -1L;
 
     func_args = PyTuple_New(1);
@@ -560,7 +560,7 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject*
         (void)pysqlite_statement_reset(self->statement);
     }
 
-    Py_SETREF(self->statement,
+    Py_XSETREF(self->statement,
               (pysqlite_Statement *)pysqlite_cache_get(self->connection->statement_cache, func_args));
     Py_DECREF(func_args);
 
@@ -569,7 +569,7 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject*
     }
 
     if (self->statement->in_use) {
-        Py_SETREF(self->statement,
+        Py_XSETREF(self->statement,
                   PyObject_New(pysqlite_Statement, &pysqlite_StatementType));
         if (!self->statement) {
             goto error;
@@ -681,7 +681,7 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject*
                 numcols = sqlite3_column_count(self->statement->st);
                 Py_END_ALLOW_THREADS
 
-                Py_SETREF(self->description, PyTuple_New(numcols));
+                Py_XSETREF(self->description, PyTuple_New(numcols));
                 if (!self->description) {
                     goto error;
                 }
index 829fb6bdcc8734c3569cf79080874d2dafa5d8d3..485020e127c03f4844ac3f2a0c72fe6365b14784 100644 (file)
@@ -2054,7 +2054,7 @@ deepcopy(PyObject** object, PyObject* memo)
     if (!copy)
         return 0;
 
-    Py_SETREF(*object, copy);
+    Py_XSETREF(*object, copy);
 
     return 1; /* success */
 }
index 23d4d5ceab22075721d1bcb15cf9f4dd37e87540..a44414b1888e484dbbd7af62cb0630e6d2c891bb 100644 (file)
@@ -1467,7 +1467,7 @@ static int PySSL_set_context(PySSLSocket *self, PyObject *value,
         return -1;
 #else
         Py_INCREF(value);
-        Py_SETREF(self->ctx, (PySSLContext *)value);
+        Py_XSETREF(self->ctx, (PySSLContext *)value);
         SSL_set_SSL_CTX(self->ssl, self->ctx->ctx);
 #endif
     } else {
index 196a0938dde8f7316f1a6e5a37f96e9d817e7319..50fb1385bfbfdaa29d0be7ea14346daefd29a9e8 100644 (file)
@@ -1377,13 +1377,13 @@ s_init(PyObject *self, PyObject *args, PyObject *kwds)
 
     if (PyString_Check(o_format)) {
         Py_INCREF(o_format);
-        Py_SETREF(soself->s_format, o_format);
+        Py_XSETREF(soself->s_format, o_format);
     }
     else if (PyUnicode_Check(o_format)) {
         PyObject *str = PyUnicode_AsEncodedString(o_format, "ascii", NULL);
         if (str == NULL)
             return -1;
-        Py_SETREF(soself->s_format, str);
+        Py_XSETREF(soself->s_format, str);
     }
     else {
         PyErr_Format(PyExc_TypeError,
index fe417c5ffa0bfef254992bee43b9870a90fb0b3e..c33e03ca223afeaa718fbf1147d3ba769ce72826 100644 (file)
@@ -1953,7 +1953,7 @@ BZ2Decomp_decompress(BZ2DecompObject *self, PyObject *args)
             self->running = 0;
             input_left += bzs->avail_in;
             if (input_left != 0) {
-                Py_SETREF(self->unused_data,
+                Py_XSETREF(self->unused_data,
                           PyString_FromStringAndSize(bzs->next_in, input_left));
                 if (self->unused_data == NULL)
                     goto error;
index a00108e1048a9a17a5694bc2cc505bb81b871c7b..cab7ca862e131018a9802b82cfddd3f1fa51a9f9 100644 (file)
@@ -689,7 +689,7 @@ read_other(Unpicklerobject *self, char **s, Py_ssize_t  n)
     }
     if (! str) return -1;
 
-    Py_SETREF(self->last_string, str);
+    Py_XSETREF(self->last_string, str);
 
     if (! (*s = PyString_AsString(str))) return -1;
 
@@ -715,7 +715,7 @@ readline_other(Unpicklerobject *self, char **s)
     if ((str_size = PyString_Size(str)) < 0)
         return -1;
 
-    Py_SETREF(self->last_string, str);
+    Py_XSETREF(self->last_string, str);
 
     if (! (*s = PyString_AsString(str)))
         return -1;
@@ -3227,7 +3227,7 @@ Pickler_set_pers_func(Picklerobject *p, PyObject *v)
         return -1;
     }
     Py_INCREF(v);
-    Py_SETREF(p->pers_func, v);
+    Py_XSETREF(p->pers_func, v);
     return 0;
 }
 
@@ -3240,7 +3240,7 @@ Pickler_set_inst_pers_func(Picklerobject *p, PyObject *v)
         return -1;
     }
     Py_INCREF(v);
-    Py_SETREF(p->inst_pers_func, v);
+    Py_XSETREF(p->inst_pers_func, v);
     return 0;
 }
 
@@ -3267,7 +3267,7 @@ Pickler_set_memo(Picklerobject *p, PyObject *v)
         return -1;
     }
     Py_INCREF(v);
-    Py_SETREF(p->memo, v);
+    Py_XSETREF(p->memo, v);
     return 0;
 }
 
@@ -5663,13 +5663,13 @@ Unpickler_setattr(Unpicklerobject *self, char *name, PyObject *value)
 
     if (!strcmp(name, "persistent_load")) {
         Py_XINCREF(value);
-        Py_SETREF(self->pers_func, value);
+        Py_XSETREF(self->pers_func, value);
         return 0;
     }
 
     if (!strcmp(name, "find_global")) {
         Py_XINCREF(value);
-        Py_SETREF(self->find_class, value);
+        Py_XSETREF(self->find_class, value);
         return 0;
     }
 
@@ -5686,7 +5686,7 @@ Unpickler_setattr(Unpicklerobject *self, char *name, PyObject *value)
             return -1;
         }
         Py_INCREF(value);
-        Py_SETREF(self->memo, value);
+        Py_XSETREF(self->memo, value);
         return 0;
     }
 
index 9ef8727767911783c7f1612ab69ce730d37e7c53..ddb2996e90b719c2d25254515f8417d10e97c9c6 100644 (file)
@@ -629,9 +629,9 @@ CD_addcallback(cdparserobject *self, PyObject *args)
                   (void *) self);
 #endif
     Py_INCREF(func);
-    Py_SETREF(self->ob_cdcallbacks[type].ob_cdcallback, func);
+    Py_XSETREF(self->ob_cdcallbacks[type].ob_cdcallback, func);
     Py_INCREF(funcarg);
-    Py_SETREF(self->ob_cdcallbacks[type].ob_cdcallbackarg, funcarg);
+    Py_XSETREF(self->ob_cdcallbacks[type].ob_cdcallbackarg, funcarg);
 
 /*
     if (type == cd_audio) {
index 68285b82f6c98c4184912f68159dee7232a4281a..24933211f98f564c8f793d565ac1d297b4533f79 100644 (file)
@@ -492,7 +492,7 @@ tee_next(teeobject *to)
         link = teedataobject_jumplink(to->dataobj);
         if (link == NULL)
             return NULL;
-        Py_SETREF(to->dataobj, (teedataobject *)link);
+        Py_XSETREF(to->dataobj, (teedataobject *)link);
         to->index = 0;
     }
     value = teedataobject_getitem(to->dataobj, to->index);
index c0e17f3a2e5625d3b0bde4b745a1e4da2e80e1bf..81674c80f57040bdd69083ff42f31772b10e40ce 100644 (file)
@@ -621,7 +621,7 @@ initsignal(void)
     if (Handlers[SIGINT].func == DefaultHandler) {
         /* Install default int handler */
         Py_INCREF(IntHandler);
-        Py_SETREF(Handlers[SIGINT].func, IntHandler);
+        Py_XSETREF(Handlers[SIGINT].func, IntHandler);
         old_siginthandler = PyOS_setsig(SIGINT, signal_handler);
     }
 
index 8c7916eb0158a2058a47361d54b23fcb7a288ee7..f3282b2eeb8425953737915c35b09973e1596d0d 100644 (file)
@@ -491,7 +491,7 @@ save_unconsumed_input(compobject *self, int err)
                       PyString_AS_STRING(self->unused_data), old_size);
             Py_MEMCPY(PyString_AS_STRING(new_data) + old_size,
                       self->zst.next_in, self->zst.avail_in);
-            Py_SETREF(self->unused_data, new_data);
+            Py_XSETREF(self->unused_data, new_data);
             self->zst.avail_in = 0;
         }
     }
@@ -503,7 +503,7 @@ save_unconsumed_input(compobject *self, int err)
                 (char *)self->zst.next_in, self->zst.avail_in);
         if (new_data == NULL)
             return -1;
-        Py_SETREF(self->unconsumed_tail, new_data);
+        Py_XSETREF(self->unconsumed_tail, new_data);
     }
     return 0;
 }
@@ -731,9 +731,9 @@ PyZlib_copy(compobject *self)
     }
 
     Py_INCREF(self->unused_data);
-    Py_SETREF(retval->unused_data, self->unused_data);
+    Py_XSETREF(retval->unused_data, self->unused_data);
     Py_INCREF(self->unconsumed_tail);
-    Py_SETREF(retval->unconsumed_tail, self->unconsumed_tail);
+    Py_XSETREF(retval->unconsumed_tail, self->unconsumed_tail);
 
     /* Mark it as being initialized */
     retval->is_initialised = 1;
@@ -780,9 +780,9 @@ PyZlib_uncopy(compobject *self)
     }
 
     Py_INCREF(self->unused_data);
-    Py_SETREF(retval->unused_data, self->unused_data);
+    Py_XSETREF(retval->unused_data, self->unused_data);
     Py_INCREF(self->unconsumed_tail);
-    Py_SETREF(retval->unconsumed_tail, self->unconsumed_tail);
+    Py_XSETREF(retval->unconsumed_tail, self->unconsumed_tail);
 
     /* Mark it as being initialized */
     retval->is_initialised = 1;
index c7271ef9d6ae34798a492e1b69a129bca7c1f69e..8d6e6e3a24671773febb3b867e062ab25a2b1ac1 100644 (file)
@@ -1332,7 +1332,7 @@ property_init(PyObject *self, PyObject *args, PyObject *kwds)
         PyObject *get_doc = PyObject_GetAttrString(get, "__doc__");
         if (get_doc) {
             if (Py_TYPE(self) == &PyProperty_Type) {
-                Py_SETREF(prop->prop_doc, get_doc);
+                Py_XSETREF(prop->prop_doc, get_doc);
             }
             else {
                 /* If this is a property subclass, put __doc__
index 8f2c7a6789fb687d66606cc156f5dc411d334a4e..8906f1a786d74f3989073895b28549ab9564922b 100644 (file)
@@ -59,11 +59,11 @@ BaseException_init(PyBaseExceptionObject *self, PyObject *args, PyObject *kwds)
         return -1;
 
     Py_INCREF(args);
-    Py_SETREF(self->args, args);
+    Py_XSETREF(self->args, args);
 
     if (PyTuple_GET_SIZE(self->args) == 1) {
         Py_INCREF(PyTuple_GET_ITEM(self->args, 0));
-        Py_SETREF(self->message, PyTuple_GET_ITEM(self->args, 0));
+        Py_XSETREF(self->message, PyTuple_GET_ITEM(self->args, 0));
     }
     return 0;
 }
@@ -279,7 +279,7 @@ BaseException_set_dict(PyBaseExceptionObject *self, PyObject *val)
         return -1;
     }
     Py_INCREF(val);
-    Py_SETREF(self->dict, val);
+    Py_XSETREF(self->dict, val);
     return 0;
 }
 
@@ -305,7 +305,7 @@ BaseException_set_args(PyBaseExceptionObject *self, PyObject *val)
     seq = PySequence_Tuple(val);
     if (!seq)
         return -1;
-    Py_SETREF(self->args, seq);
+    Py_XSETREF(self->args, seq);
     return 0;
 }
 
@@ -519,11 +519,11 @@ SystemExit_init(PySystemExitObject *self, PyObject *args, PyObject *kwds)
         return 0;
     if (size == 1) {
         Py_INCREF(PyTuple_GET_ITEM(args, 0));
-        Py_SETREF(self->code, PyTuple_GET_ITEM(args, 0));
+        Py_XSETREF(self->code, PyTuple_GET_ITEM(args, 0));
     }
     else { /* size > 1 */
         Py_INCREF(args);
-        Py_SETREF(self->code, args);
+        Py_XSETREF(self->code, args);
     }
     return 0;
 }
@@ -608,21 +608,21 @@ EnvironmentError_init(PyEnvironmentErrorObject *self, PyObject *args,
         return -1;
     }
     Py_INCREF(myerrno);
-    Py_SETREF(self->myerrno, myerrno);
+    Py_XSETREF(self->myerrno, myerrno);
 
     Py_INCREF(strerror);
-    Py_SETREF(self->strerror, strerror);
+    Py_XSETREF(self->strerror, strerror);
 
     /* self->filename will remain Py_None otherwise */
     if (filename != NULL) {
         Py_INCREF(filename);
-        Py_SETREF(self->filename, filename);
+        Py_XSETREF(self->filename, filename);
 
         subslice = PyTuple_GetSlice(args, 0, 2);
         if (!subslice)
             return -1;
 
-        Py_SETREF(self->args, subslice);
+        Py_XSETREF(self->args, subslice);
     }
     return 0;
 }
@@ -873,7 +873,7 @@ WindowsError_init(PyWindowsErrorObject *self, PyObject *args, PyObject *kwds)
         return -1;
     posix_errno = winerror_to_errno(errcode);
 
-    Py_SETREF(self->winerror, self->myerrno);
+    Py_XSETREF(self->winerror, self->myerrno);
 
     o_errcode = PyInt_FromLong(posix_errno);
     if (!o_errcode)
@@ -1059,7 +1059,7 @@ SyntaxError_init(PySyntaxErrorObject *self, PyObject *args, PyObject *kwds)
 
     if (lenargs >= 1) {
         Py_INCREF(PyTuple_GET_ITEM(args, 0));
-        Py_SETREF(self->msg, PyTuple_GET_ITEM(args, 0));
+        Py_XSETREF(self->msg, PyTuple_GET_ITEM(args, 0));
     }
     if (lenargs == 2) {
         info = PyTuple_GET_ITEM(args, 1);
@@ -1075,16 +1075,16 @@ SyntaxError_init(PySyntaxErrorObject *self, PyObject *args, PyObject *kwds)
         }
 
         Py_INCREF(PyTuple_GET_ITEM(info, 0));
-        Py_SETREF(self->filename, PyTuple_GET_ITEM(info, 0));
+        Py_XSETREF(self->filename, PyTuple_GET_ITEM(info, 0));
 
         Py_INCREF(PyTuple_GET_ITEM(info, 1));
-        Py_SETREF(self->lineno, PyTuple_GET_ITEM(info, 1));
+        Py_XSETREF(self->lineno, PyTuple_GET_ITEM(info, 1));
 
         Py_INCREF(PyTuple_GET_ITEM(info, 2));
-        Py_SETREF(self->offset, PyTuple_GET_ITEM(info, 2));
+        Py_XSETREF(self->offset, PyTuple_GET_ITEM(info, 2));
 
         Py_INCREF(PyTuple_GET_ITEM(info, 3));
-        Py_SETREF(self->text, PyTuple_GET_ITEM(info, 3));
+        Py_XSETREF(self->text, PyTuple_GET_ITEM(info, 3));
 
         Py_DECREF(info);
     }
@@ -1317,7 +1317,7 @@ set_string(PyObject **attr, const char *value)
     PyObject *obj = PyString_FromString(value);
     if (!obj)
         return -1;
-    Py_SETREF(*attr, obj);
+    Py_XSETREF(*attr, obj);
     return 0;
 }
 
index 9ae068cfc59d403b1fa7fc40dc187373f95cf21f..e4f7fc404dd68c81009a31b5d303ff0e85054644 100644 (file)
@@ -574,8 +574,8 @@ PyFile_SetEncodingAndErrors(PyObject *f, const char *enc, char* errors)
         oerrors = Py_None;
         Py_INCREF(Py_None);
     }
-    Py_SETREF(file->f_encoding, str);
-    Py_SETREF(file->f_errors, oerrors);
+    Py_XSETREF(file->f_encoding, str);
+    Py_XSETREF(file->f_errors, oerrors);
     return 1;
 }
 
index 6ca390b34b311768e544b543de66f78ca16c4fbb..4ba3e84b0f20c9c6cd1bc1af38194becbe865b81 100644 (file)
@@ -859,7 +859,7 @@ dict_to_map(PyObject *map, Py_ssize_t nmap, PyObject *dict, PyObject **values,
             }
         } else if (values[j] != value) {
             Py_XINCREF(value);
-            Py_SETREF(values[j], value);
+            Py_XSETREF(values[j], value);
         }
         Py_XDECREF(value);
     }
index da54069d52e6cd68fbb2083cb79a5d8b6b3bee56..26369626f959ba6f673cdcd070fdce435b49d9e9 100644 (file)
@@ -116,7 +116,7 @@ PyFunction_SetDefaults(PyObject *op, PyObject *defaults)
         PyErr_SetString(PyExc_SystemError, "non-tuple default args");
         return -1;
     }
-    Py_SETREF(((PyFunctionObject *)op)->func_defaults, defaults);
+    Py_XSETREF(((PyFunctionObject *)op)->func_defaults, defaults);
     return 0;
 }
 
@@ -148,7 +148,7 @@ PyFunction_SetClosure(PyObject *op, PyObject *closure)
                      closure->ob_type->tp_name);
         return -1;
     }
-    Py_SETREF(((PyFunctionObject *)op)->func_closure, closure);
+    Py_XSETREF(((PyFunctionObject *)op)->func_closure, closure);
     return 0;
 }
 
@@ -428,7 +428,7 @@ func_new(PyTypeObject* type, PyObject* args, PyObject* kw)
 
     if (name != Py_None) {
         Py_INCREF(name);
-        Py_SETREF(newfunc->func_name, name);
+        Py_XSETREF(newfunc->func_name, name);
     }
     if (defaults != Py_None) {
         Py_INCREF(defaults);
index f585ffc7282111bd798c6a81ed521d6d84f0dfe3..faaa11125cda86fdff88e3423c0c3efcc5bf5ab9 100644 (file)
@@ -3865,7 +3865,7 @@ PyString_Concat(register PyObject **pv, register PyObject *w)
         return;
     }
     v = string_concat((PyStringObject *) *pv, w);
-    Py_SETREF(*pv, v);
+    Py_XSETREF(*pv, v);
 }
 
 void
@@ -4750,7 +4750,7 @@ PyString_InternInPlace(PyObject **p)
     t = PyDict_GetItem(interned, (PyObject *)s);
     if (t) {
         Py_INCREF(t);
-        Py_SETREF(*p, t);
+        Py_XSETREF(*p, t);
         return;
     }
 
index a5f3997ee9ae15f44304c697087aec9664d1ff43..b186623fe78cced075bf242265ffa4663e1ec52e 100644 (file)
@@ -188,7 +188,7 @@ assign_version_tag(PyTypeObject *type)
         for (i = 0; i < (1 << MCACHE_SIZE_EXP); i++) {
             method_cache[i].value = NULL;
             Py_INCREF(Py_None);
-            Py_SETREF(method_cache[i].name, Py_None);
+            Py_XSETREF(method_cache[i].name, Py_None);
         }
         /* mark all version tags as invalid */
         PyType_Modified(&PyBaseObject_Type);
index 9f503bde63e59b3a295aa1476da974f7c0467bfc..454451eb671cb5c793cd62b169fe37fbe0bdbb51 100644 (file)
@@ -436,7 +436,7 @@ int _PyUnicode_Resize(PyUnicodeObject **unicode, Py_ssize_t length)
             return -1;
         Py_UNICODE_COPY(w->str, v->str,
                         length < v->length ? length : v->length);
-        Py_SETREF(*unicode, w);
+        Py_XSETREF(*unicode, w);
         return 0;
     }
 
index 8e8c0cceb311df6752f4ebe751318128c38f723d..932f2f8d13d25015550ef3cad4a81af05c1b5c59 100644 (file)
@@ -528,7 +528,7 @@ setup_context(Py_ssize_t stack_level, PyObject **filename, int *lineno,
                     goto handle_error;
                 }
                 else if (!is_true) {
-                    Py_SETREF(*filename, PyString_FromString("__main__"));
+                    Py_XSETREF(*filename, PyString_FromString("__main__"));
                     if (*filename == NULL)
                         goto handle_error;
                 }
index 6e5e27280e9cf1e50fca104511d50256b4e6e73c..e56e9574900fe80b5a56849a1a1dbe64d0fc4301 100644 (file)
@@ -4360,7 +4360,7 @@ call_function(PyObject ***pp_stack, int oparg
             Py_INCREF(self);
             func = PyMethod_GET_FUNCTION(func);
             Py_INCREF(func);
-            Py_SETREF(*pfunc, self);
+            Py_XSETREF(*pfunc, self);
             na++;
             n++;
         } else
index bad1f509b0593cd18d16b898dfbeb2d59616cc1c..51f2874b9472f3301087f6d5b45b867a79b930f8 100644 (file)
@@ -1415,7 +1415,7 @@ compiler_class(struct compiler *c, stmt_ty s)
                               s->lineno))
         return 0;
     Py_INCREF(s->v.ClassDef.name);
-    Py_SETREF(c->u->u_private, s->v.ClassDef.name);
+    Py_XSETREF(c->u->u_private, s->v.ClassDef.name);
     str = PyString_InternFromString("__name__");
     if (!str || !compiler_nameop(c, str, Load)) {
         Py_XDECREF(str);
index d823e1397ccb6a56778f2d4be70965fa887e3d80..466a2534dd6a1997af9241fe5d0530fc39f5b24e 100644 (file)
@@ -229,9 +229,9 @@ finally:
         --tstate->recursion_depth;
         /* throw away the old exception and use the recursion error instead */
         Py_INCREF(PyExc_RuntimeError);
-        Py_SETREF(*exc, PyExc_RuntimeError);
+        Py_XSETREF(*exc, PyExc_RuntimeError);
         Py_INCREF(PyExc_RecursionErrorInst);
-        Py_SETREF(*val, PyExc_RecursionErrorInst);
+        Py_XSETREF(*val, PyExc_RecursionErrorInst);
         /* just keeping the old traceback */
         return;
     }