[Python-checkins] cpython (2.7): Issue #22570: Renamed Py_SETREF to Py_XSETREF.

serhiy.storchaka python-checkins at python.org
Wed Apr 6 02:51:59 EDT 2016


https://hg.python.org/cpython/rev/7197809a7428
changeset:   100859:7197809a7428
branch:      2.7
parent:      100850:6137c46cb8df
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Wed Apr 06 09:51:18 2016 +0300
summary:
  Issue #22570: Renamed Py_SETREF to Py_XSETREF.

files:
  Include/object.h             |   4 +-
  Modules/_bsddb.c             |  10 +++---
  Modules/_csv.c               |   4 +-
  Modules/_ctypes/_ctypes.c    |  24 ++++++++--------
  Modules/_curses_panel.c      |   2 +-
  Modules/_elementtree.c       |  18 ++++++------
  Modules/_functoolsmodule.c   |   8 ++--
  Modules/_io/bufferedio.c     |   8 ++--
  Modules/_io/textio.c         |  10 +++---
  Modules/_json.c              |   2 +-
  Modules/_sqlite/connection.c |   8 ++--
  Modules/_sqlite/cursor.c     |  10 +++---
  Modules/_sre.c               |   2 +-
  Modules/_ssl.c               |   2 +-
  Modules/_struct.c            |   4 +-
  Modules/bz2module.c          |   2 +-
  Modules/cPickle.c            |  16 +++++-----
  Modules/cdmodule.c           |   4 +-
  Modules/itertoolsmodule.c    |   2 +-
  Modules/signalmodule.c       |   2 +-
  Modules/zlibmodule.c         |  12 ++++----
  Objects/descrobject.c        |   2 +-
  Objects/exceptions.c         |  34 ++++++++++++------------
  Objects/fileobject.c         |   4 +-
  Objects/frameobject.c        |   2 +-
  Objects/funcobject.c         |   6 ++--
  Objects/stringobject.c       |   4 +-
  Objects/typeobject.c         |   2 +-
  Objects/unicodeobject.c      |   2 +-
  Python/_warnings.c           |   2 +-
  Python/ceval.c               |   2 +-
  Python/compile.c             |   2 +-
  Python/errors.c              |   4 +-
  33 files changed, 110 insertions(+), 110 deletions(-)


diff --git a/Include/object.h b/Include/object.h
--- a/Include/object.h
+++ b/Include/object.h
@@ -833,14 +833,14 @@
  *
  * 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);                           \
diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c
--- a/Modules/_bsddb.c
+++ b/Modules/_bsddb.c
@@ -1608,7 +1608,7 @@
 
     /* 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 @@
 {
     /* 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 @@
 {
     /* 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 @@
     }
 
     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 @@
     RETURN_IF_ERR();
 
     Py_INCREF(rep_transport);
-    Py_SETREF(self->rep_transport, rep_transport);
+    Py_XSETREF(self->rep_transport, rep_transport);
     RETURN_NONE();
 }
 
diff --git a/Modules/_csv.c b/Modules/_csv.c
--- a/Modules/_csv.c
+++ b/Modules/_csv.c
@@ -277,7 +277,7 @@
         }
         else {
             Py_INCREF(src);
-            Py_SETREF(*target, src);
+            Py_XSETREF(*target, src);
         }
     }
     return 0;
@@ -769,7 +769,7 @@
 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;
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -424,7 +424,7 @@
         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 @@
         return -1;
     }
     Py_INCREF(proto);
-    Py_SETREF(stgdict->proto, proto);
+    Py_XSETREF(stgdict->proto, proto);
     return 0;
 }
 
@@ -992,7 +992,7 @@
         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 @@
         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 @@
         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 @@
         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 @@
     }
     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 @@
         return -1;
     }
     Py_XINCREF(ob);
-    Py_SETREF(self->errcheck, ob);
+    Py_XSETREF(self->errcheck, ob);
     return 0;
 }
 
@@ -3082,8 +3082,8 @@
         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 @@
         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;
 }
diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c
--- a/Modules/_curses_panel.c
+++ b/Modules/_curses_panel.c
@@ -284,7 +284,7 @@
         return NULL;
     }
     Py_INCREF(temp);
-    Py_SETREF(po->wo, temp);
+    Py_XSETREF(po->wo, temp);
     Py_INCREF(Py_None);
     return Py_None;
 }
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -1574,7 +1574,7 @@
 
     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 @@
         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 @@
     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 @@
     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 @@
         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,
diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c
--- a/Modules/_functoolsmodule.c
+++ b/Modules/_functoolsmodule.c
@@ -320,10 +320,10 @@
     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;
 }
 
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c
--- a/Modules/_io/bufferedio.c
+++ b/Modules/_io/bufferedio.c
@@ -1028,7 +1028,7 @@
         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 @@
         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 @@
         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 @@
         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;
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -966,7 +966,7 @@
                 "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 @@
 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 @@
             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 @@
         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 @@
     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);
diff --git a/Modules/_json.c b/Modules/_json.c
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -1717,7 +1717,7 @@
     }
     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;
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -228,7 +228,7 @@
         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 @@
 
     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 @@
         }
     }
 
-    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 @@
         }
     }
 
-    Py_SETREF(self->cursors, new_list);
+    Py_XSETREF(self->cursors, new_list);
 }
 
 PyObject* pysqlite_connection_create_function(pysqlite_Connection* self, PyObject* args, PyObject* kwargs)
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c
--- a/Modules/_sqlite/cursor.c
+++ b/Modules/_sqlite/cursor.c
@@ -172,7 +172,7 @@
         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 @@
 
     /* 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 @@
         (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 @@
     }
 
     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 @@
                 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;
                 }
diff --git a/Modules/_sre.c b/Modules/_sre.c
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -2054,7 +2054,7 @@
     if (!copy)
         return 0;
 
-    Py_SETREF(*object, copy);
+    Py_XSETREF(*object, copy);
 
     return 1; /* success */
 }
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -1467,7 +1467,7 @@
         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 {
diff --git a/Modules/_struct.c b/Modules/_struct.c
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -1377,13 +1377,13 @@
 
     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,
diff --git a/Modules/bz2module.c b/Modules/bz2module.c
--- a/Modules/bz2module.c
+++ b/Modules/bz2module.c
@@ -1953,7 +1953,7 @@
             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;
diff --git a/Modules/cPickle.c b/Modules/cPickle.c
--- a/Modules/cPickle.c
+++ b/Modules/cPickle.c
@@ -689,7 +689,7 @@
     }
     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 @@
     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 @@
         return -1;
     }
     Py_INCREF(v);
-    Py_SETREF(p->pers_func, v);
+    Py_XSETREF(p->pers_func, v);
     return 0;
 }
 
@@ -3240,7 +3240,7 @@
         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 @@
         return -1;
     }
     Py_INCREF(v);
-    Py_SETREF(p->memo, v);
+    Py_XSETREF(p->memo, v);
     return 0;
 }
 
@@ -5663,13 +5663,13 @@
 
     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 @@
             return -1;
         }
         Py_INCREF(value);
-        Py_SETREF(self->memo, value);
+        Py_XSETREF(self->memo, value);
         return 0;
     }
 
diff --git a/Modules/cdmodule.c b/Modules/cdmodule.c
--- a/Modules/cdmodule.c
+++ b/Modules/cdmodule.c
@@ -629,9 +629,9 @@
                   (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) {
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c
--- a/Modules/itertoolsmodule.c
+++ b/Modules/itertoolsmodule.c
@@ -492,7 +492,7 @@
         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);
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -621,7 +621,7 @@
     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);
     }
 
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c
--- a/Modules/zlibmodule.c
+++ b/Modules/zlibmodule.c
@@ -491,7 +491,7 @@
                       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 @@
                 (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 @@
     }
 
     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 @@
     }
 
     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;
diff --git a/Objects/descrobject.c b/Objects/descrobject.c
--- a/Objects/descrobject.c
+++ b/Objects/descrobject.c
@@ -1332,7 +1332,7 @@
         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__
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -59,11 +59,11 @@
         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 @@
         return -1;
     }
     Py_INCREF(val);
-    Py_SETREF(self->dict, val);
+    Py_XSETREF(self->dict, val);
     return 0;
 }
 
@@ -305,7 +305,7 @@
     seq = PySequence_Tuple(val);
     if (!seq)
         return -1;
-    Py_SETREF(self->args, seq);
+    Py_XSETREF(self->args, seq);
     return 0;
 }
 
@@ -519,11 +519,11 @@
         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 @@
         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 @@
         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 @@
 
     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 @@
         }
 
         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 @@
     PyObject *obj = PyString_FromString(value);
     if (!obj)
         return -1;
-    Py_SETREF(*attr, obj);
+    Py_XSETREF(*attr, obj);
     return 0;
 }
 
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -574,8 +574,8 @@
         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;
 }
 
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -859,7 +859,7 @@
             }
         } else if (values[j] != value) {
             Py_XINCREF(value);
-            Py_SETREF(values[j], value);
+            Py_XSETREF(values[j], value);
         }
         Py_XDECREF(value);
     }
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -116,7 +116,7 @@
         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 @@
                      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 @@
 
     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);
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -3865,7 +3865,7 @@
         return;
     }
     v = string_concat((PyStringObject *) *pv, w);
-    Py_SETREF(*pv, v);
+    Py_XSETREF(*pv, v);
 }
 
 void
@@ -4750,7 +4750,7 @@
     t = PyDict_GetItem(interned, (PyObject *)s);
     if (t) {
         Py_INCREF(t);
-        Py_SETREF(*p, t);
+        Py_XSETREF(*p, t);
         return;
     }
 
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -188,7 +188,7 @@
         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);
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -436,7 +436,7 @@
             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;
     }
 
diff --git a/Python/_warnings.c b/Python/_warnings.c
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -528,7 +528,7 @@
                     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;
                 }
diff --git a/Python/ceval.c b/Python/ceval.c
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -4360,7 +4360,7 @@
             Py_INCREF(self);
             func = PyMethod_GET_FUNCTION(func);
             Py_INCREF(func);
-            Py_SETREF(*pfunc, self);
+            Py_XSETREF(*pfunc, self);
             na++;
             n++;
         } else
diff --git a/Python/compile.c b/Python/compile.c
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -1415,7 +1415,7 @@
                               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);
diff --git a/Python/errors.c b/Python/errors.c
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -229,9 +229,9 @@
         --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;
     }

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list