[Python-checkins] cpython (3.5): 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/d0c8b2c1544e
changeset:   100857:d0c8b2c1544e
branch:      3.5
parent:      100855:2577a3684f90
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Wed Apr 06 09:45:48 2016 +0300
summary:
  Issue #22570: Renamed Py_SETREF to Py_XSETREF.

files:
  Include/object.h                   |   4 +-
  Modules/_bz2module.c               |   2 +-
  Modules/_csv.c                     |   4 +-
  Modules/_ctypes/_ctypes.c          |  28 +++++++-------
  Modules/_curses_panel.c            |   2 +-
  Modules/_elementtree.c             |  22 ++++++------
  Modules/_functoolsmodule.c         |   8 ++--
  Modules/_io/bufferedio.c           |   8 ++--
  Modules/_io/bytesio.c              |   2 +-
  Modules/_io/textio.c               |   8 ++--
  Modules/_lzmamodule.c              |   2 +-
  Modules/_pickle.c                  |   4 +-
  Modules/_sqlite/connection.c       |   8 ++--
  Modules/_sqlite/cursor.c           |  10 ++--
  Modules/_sre.c                     |   2 +-
  Modules/_ssl.c                     |   4 +-
  Modules/_struct.c                  |   2 +-
  Modules/cjkcodecs/multibytecodec.c |   2 +-
  Modules/faulthandler.c             |   6 +-
  Modules/itertoolsmodule.c          |  28 +++++++-------
  Modules/signalmodule.c             |   2 +-
  Modules/zipimport.c                |   2 +-
  Modules/zlibmodule.c               |  16 ++++----
  Objects/bytesobject.c              |   2 +-
  Objects/descrobject.c              |   2 +-
  Objects/exceptions.c               |  32 +++++++++---------
  Objects/frameobject.c              |   2 +-
  Objects/funcobject.c               |  10 ++--
  Objects/moduleobject.c             |   2 +-
  Objects/rangeobject.c              |   6 +-
  Objects/typeobject.c               |   8 ++--
  Objects/unicodeobject.c            |   8 ++--
  Parser/tokenizer.c                 |   2 +-
  Python/_warnings.c                 |   2 +-
  Python/ceval.c                     |   6 +-
  Python/compile.c                   |   2 +-
  Python/errors.c                    |   4 +-
  37 files changed, 132 insertions(+), 132 deletions(-)


diff --git a/Include/object.h b/Include/object.h
--- a/Include/object.h
+++ b/Include/object.h
@@ -856,14 +856,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/_bz2module.c b/Modules/_bz2module.c
--- a/Modules/_bz2module.c
+++ b/Modules/_bz2module.c
@@ -540,7 +540,7 @@
     if (d->eof) {
         d->needs_input = 0;
         if (d->bzs_avail_in_real > 0) {
-            Py_SETREF(d->unused_data,
+            Py_XSETREF(d->unused_data,
                       PyBytes_FromStringAndSize(bzs->next_in, d->bzs_avail_in_real));
             if (d->unused_data == NULL)
                 goto error;
diff --git a/Modules/_csv.c b/Modules/_csv.c
--- a/Modules/_csv.c
+++ b/Modules/_csv.c
@@ -277,7 +277,7 @@
             if (PyUnicode_READY(src) == -1)
                 return -1;
             Py_INCREF(src);
-            Py_SETREF(*target, src);
+            Py_XSETREF(*target, src);
         }
     }
     return 0;
@@ -783,7 +783,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
@@ -391,7 +391,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);
@@ -870,7 +870,7 @@
         return -1;
     }
     Py_INCREF(proto);
-    Py_SETREF(stgdict->proto, proto);
+    Py_XSETREF(stgdict->proto, proto);
     return 0;
 }
 
@@ -960,7 +960,7 @@
         Py_DECREF((PyObject *)stgdict);
         return NULL;
     }
-    Py_SETREF(result->tp_dict, (PyObject *)stgdict);
+    Py_XSETREF(result->tp_dict, (PyObject *)stgdict);
 
     return (PyObject *)result;
 }
@@ -1403,7 +1403,7 @@
     /* replace the class dict by our updated spam dict */
     if (-1 == PyDict_Update((PyObject *)stgdict, result->tp_dict))
         goto error;
-    Py_SETREF(result->tp_dict, (PyObject *)stgdict);  /* steal the reference */
+    Py_XSETREF(result->tp_dict, (PyObject *)stgdict);  /* steal the reference */
     stgdict = NULL;
 
     /* Special case for character arrays.
@@ -1816,7 +1816,7 @@
         Py_DECREF((PyObject *)stgdict);
         return NULL;
     }
-    Py_SETREF(result->tp_dict, (PyObject *)stgdict);
+    Py_XSETREF(result->tp_dict, (PyObject *)stgdict);
 
     return (PyObject *)result;
 }
@@ -1944,7 +1944,7 @@
         Py_DECREF((PyObject *)stgdict);
         return NULL;
     }
-    Py_SETREF(result->tp_dict, (PyObject *)stgdict);
+    Py_XSETREF(result->tp_dict, (PyObject *)stgdict);
 
     /* Install from_param class methods in ctypes base classes.
        Overrides the PyCSimpleType_from_param generic method.
@@ -2307,7 +2307,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);
@@ -2451,7 +2451,7 @@
         return -1;
     }
     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);
@@ -2955,7 +2955,7 @@
         return -1;
     }
     Py_XINCREF(ob);
-    Py_SETREF(self->errcheck, ob);
+    Py_XSETREF(self->errcheck, ob);
     return 0;
 }
 
@@ -2984,8 +2984,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;
@@ -3022,9 +3022,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;
 }
@@ -5152,7 +5152,7 @@
 
     bself = (PyBaseExceptionObject *)self;
     Py_INCREF(args);
-    Py_SETREF(bself->args, args);
+    Py_XSETREF(bself->args, args);
 
     return 0;
 }
diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c
--- a/Modules/_curses_panel.c
+++ b/Modules/_curses_panel.c
@@ -313,7 +313,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
@@ -936,7 +936,7 @@
     }
 
     Py_INCREF(tag);
-    Py_SETREF(self->tag, tag);
+    Py_XSETREF(self->tag, tag);
 
     _clear_joined_ptr(&self->text);
     self->text = text ? JOIN_SET(text, PyList_CheckExact(text)) : Py_None;
@@ -980,7 +980,7 @@
     /* Stash attrib. */
     if (attrib) {
         Py_INCREF(attrib);
-        Py_SETREF(self->extra->attrib, attrib);
+        Py_XSETREF(self->extra->attrib, attrib);
     }
 
     Py_RETURN_NONE;
@@ -1943,7 +1943,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;
@@ -1958,7 +1958,7 @@
                 return -1;
         }
         Py_INCREF(value);
-        Py_SETREF(self->extra->attrib, value);
+        Py_XSETREF(self->extra->attrib, value);
     } else {
         PyErr_SetString(PyExc_AttributeError,
             "Can't set arbitrary attributes on Element");
@@ -2551,9 +2551,9 @@
     self->index++;
 
     Py_INCREF(node);
-    Py_SETREF(self->this, node);
+    Py_XSETREF(self->this, node);
     Py_INCREF(node);
-    Py_SETREF(self->last, node);
+    Py_XSETREF(self->last, node);
 
     if (treebuilder_append_event(self, self->start_event_obj, node) < 0)
         goto error;
@@ -3604,7 +3604,7 @@
     target = (TreeBuilderObject*) self->target;
 
     Py_INCREF(events_queue);
-    Py_SETREF(target->events, events_queue);
+    Py_XSETREF(target->events, events_queue);
 
     /* clear out existing events */
     Py_CLEAR(target->start_event_obj);
@@ -3639,18 +3639,18 @@
 
         Py_INCREF(event_name_obj);
         if (strcmp(event_name, "start") == 0) {
-            Py_SETREF(target->start_event_obj, event_name_obj);
+            Py_XSETREF(target->start_event_obj, event_name_obj);
         } else if (strcmp(event_name, "end") == 0) {
-            Py_SETREF(target->end_event_obj, event_name_obj);
+            Py_XSETREF(target->end_event_obj, event_name_obj);
         } else if (strcmp(event_name, "start-ns") == 0) {
-            Py_SETREF(target->start_ns_event_obj, event_name_obj);
+            Py_XSETREF(target->start_ns_event_obj, event_name_obj);
             EXPAT(SetNamespaceDeclHandler)(
                 self->parser,
                 (XML_StartNamespaceDeclHandler) expat_start_ns_handler,
                 (XML_EndNamespaceDeclHandler) expat_end_ns_handler
                 );
         } else if (strcmp(event_name, "end-ns") == 0) {
-            Py_SETREF(target->end_ns_event_obj, event_name_obj);
+            Py_XSETREF(target->end_ns_event_obj, event_name_obj);
             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
@@ -294,10 +294,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
@@ -1196,7 +1196,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)
@@ -1452,7 +1452,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;
@@ -1804,7 +1804,7 @@
         return -1;
 
     Py_INCREF(raw);
-    Py_SETREF(self->raw, raw);
+    Py_XSETREF(self->raw, raw);
     self->readable = 0;
     self->writable = 1;
 
@@ -2307,7 +2307,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/bytesio.c b/Modules/_io/bytesio.c
--- a/Modules/_io/bytesio.c
+++ b/Modules/_io/bytesio.c
@@ -969,7 +969,7 @@
     if (initvalue && initvalue != Py_None) {
         if (PyBytes_CheckExact(initvalue)) {
             Py_INCREF(initvalue);
-            Py_SETREF(self->buf, initvalue);
+            Py_XSETREF(self->buf, initvalue);
             self->string_size = PyBytes_GET_SIZE(initvalue);
         }
         else {
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -995,7 +995,7 @@
                 "Oi", self->decoder, (int)self->readtranslate);
             if (incrementalDecoder == NULL)
                 goto error;
-            Py_SETREF(self->decoder, incrementalDecoder);
+            Py_XSETREF(self->decoder, incrementalDecoder);
         }
     }
 
@@ -1373,7 +1373,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;
 }
 
@@ -1521,7 +1521,7 @@
             dec_buffer = NULL; /* Reference lost to PyBytes_Concat */
             goto fail;
         }
-        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);
 
@@ -1627,7 +1627,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);
diff --git a/Modules/_lzmamodule.c b/Modules/_lzmamodule.c
--- a/Modules/_lzmamodule.c
+++ b/Modules/_lzmamodule.c
@@ -1011,7 +1011,7 @@
     if (d->eof) {
         d->needs_input = 0;
         if (lzs->avail_in > 0) {
-            Py_SETREF(d->unused_data,
+            Py_XSETREF(d->unused_data,
                       PyBytes_FromStringAndSize((char *)lzs->next_in, lzs->avail_in));
             if (d->unused_data == NULL)
                 goto error;
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -846,7 +846,7 @@
 static int
 _Pickler_ClearBuffer(PicklerObject *self)
 {
-    Py_SETREF(self->output_buffer,
+    Py_XSETREF(self->output_buffer,
               PyBytes_FromStringAndSize(NULL, self->max_output_len));
     if (self->output_buffer == NULL)
         return -1;
@@ -3089,7 +3089,7 @@
             return -1;
         }
         Py_INCREF(item);
-        Py_SETREF(*module_name, item);
+        Py_XSETREF(*module_name, item);
     }
     else if (PyErr_Occurred()) {
         return -1;
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -204,7 +204,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;
@@ -319,7 +319,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;
@@ -794,7 +794,7 @@
         }
     }
 
-    Py_SETREF(self->statements, new_list);
+    Py_XSETREF(self->statements, new_list);
 }
 
 static void _pysqlite_drop_unused_cursor_references(pysqlite_Connection* self)
@@ -825,7 +825,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
@@ -170,7 +170,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;
@@ -510,7 +510,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);
@@ -526,7 +526,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);
 
@@ -535,7 +535,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;
@@ -652,7 +652,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
@@ -756,7 +756,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
@@ -1589,7 +1589,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 {
@@ -1646,7 +1646,7 @@
 static int
 PySSL_set_owner(PySSLSocket *self, PyObject *value, void *c)
 {
-    Py_SETREF(self->owner, PyWeakref_NewRef(value, NULL));
+    Py_XSETREF(self->owner, PyWeakref_NewRef(value, NULL));
     if (self->owner == NULL)
         return -1;
     return 0;
diff --git a/Modules/_struct.c b/Modules/_struct.c
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -1437,7 +1437,7 @@
         return -1;
     }
 
-    Py_SETREF(soself->s_format, o_format);
+    Py_XSETREF(soself->s_format, o_format);
 
     ret = prepare_s(soself);
     return ret;
diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c
--- a/Modules/cjkcodecs/multibytecodec.c
+++ b/Modules/cjkcodecs/multibytecodec.c
@@ -793,7 +793,7 @@
                               ctx->errors, final ? MBENC_FLUSH | MBENC_RESET : 0);
     if (r == NULL) {
         /* recover the original pending buffer */
-        Py_SETREF(ctx->pending, origpending);
+        Py_XSETREF(ctx->pending, origpending);
         origpending = NULL;
         goto errorexit;
     }
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -381,7 +381,7 @@
         return NULL;
 
     Py_XINCREF(file);
-    Py_SETREF(fatal_error.file, file);
+    Py_XSETREF(fatal_error.file, file);
     fatal_error.fd = fd;
     fatal_error.all_threads = all_threads;
     fatal_error.interp = tstate->interp;
@@ -599,7 +599,7 @@
     cancel_dump_traceback_later();
 
     Py_XINCREF(file);
-    Py_SETREF(thread.file, file);
+    Py_XSETREF(thread.file, file);
     thread.fd = fd;
     thread.timeout_us = timeout_us;
     thread.repeat = repeat;
@@ -777,7 +777,7 @@
     }
 
     Py_XINCREF(file);
-    Py_SETREF(user->file, file);
+    Py_XSETREF(user->file, file);
     user->fd = fd;
     user->all_threads = all_threads;
     user->chain = chain;
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c
--- a/Modules/itertoolsmodule.c
+++ b/Modules/itertoolsmodule.c
@@ -158,11 +158,11 @@
     if (!PyArg_ParseTuple(state, "OOO", &currkey, &currvalue, &tgtkey))
         return NULL;
     Py_INCREF(currkey);
-    Py_SETREF(lz->currkey, currkey);
+    Py_XSETREF(lz->currkey, currkey);
     Py_INCREF(currvalue);
-    Py_SETREF(lz->currvalue, currvalue);
+    Py_XSETREF(lz->currvalue, currvalue);
     Py_INCREF(tgtkey);
-    Py_SETREF(lz->tgtkey, tgtkey);
+    Py_XSETREF(lz->tgtkey, tgtkey);
     Py_RETURN_NONE;
 }
 
@@ -631,7 +631,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);
@@ -743,7 +743,7 @@
         return NULL;
     }
     Py_INCREF(tdo);
-    Py_SETREF(to->dataobj, tdo);
+    Py_XSETREF(to->dataobj, tdo);
     to->index = index;
     Py_RETURN_NONE;
 }
@@ -969,7 +969,7 @@
     if (!PyArg_ParseTuple(state, "Oi", &saved, &firstpass))
         return NULL;
     Py_XINCREF(saved);
-    Py_SETREF(lz->saved, saved);
+    Py_XSETREF(lz->saved, saved);
     lz->firstpass = firstpass != 0;
     Py_RETURN_NONE;
 }
@@ -1895,9 +1895,9 @@
         return NULL;
 
     Py_INCREF(source);
-    Py_SETREF(lz->source, source);
+    Py_XSETREF(lz->source, source);
     Py_XINCREF(active);
-    Py_SETREF(lz->active, active);
+    Py_XSETREF(lz->active, active);
     Py_RETURN_NONE;
 }
 
@@ -2253,7 +2253,7 @@
         Py_INCREF(element);
         PyTuple_SET_ITEM(result, i, element);
     }
-    Py_SETREF(lz->result, result);
+    Py_XSETREF(lz->result, result);
     Py_RETURN_NONE;
 }
 
@@ -2575,7 +2575,7 @@
         PyTuple_SET_ITEM(result, i, element);
     }
 
-    Py_SETREF(lz->result, result);
+    Py_XSETREF(lz->result, result);
     Py_RETURN_NONE;
 }
 
@@ -2905,7 +2905,7 @@
         Py_INCREF(element);
         PyTuple_SET_ITEM(result, i, element);
     }
-    Py_SETREF(lz->result, result);
+    Py_XSETREF(lz->result, result);
     Py_RETURN_NONE;
 }
 
@@ -3298,7 +3298,7 @@
         Py_INCREF(element);
         PyTuple_SET_ITEM(result, i, element);
     }
-    Py_SETREF(po->result, result);
+    Py_XSETREF(po->result, result);
     Py_RETURN_NONE;
 }
 
@@ -3486,7 +3486,7 @@
 accumulate_setstate(accumulateobject *lz, PyObject *state)
 {
     Py_INCREF(state);
-    Py_SETREF(lz->total, state);
+    Py_XSETREF(lz->total, state);
     Py_RETURN_NONE;
 }
 
@@ -4468,7 +4468,7 @@
 zip_longest_setstate(ziplongestobject *lz, PyObject *state)
 {
     Py_INCREF(state);
-    Py_SETREF(lz->fillvalue, state);
+    Py_XSETREF(lz->fillvalue, state);
     Py_RETURN_NONE;
 }
 
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -1266,7 +1266,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/zipimport.c b/Modules/zipimport.c
--- a/Modules/zipimport.c
+++ b/Modules/zipimport.c
@@ -155,7 +155,7 @@
             tmp = PyUnicode_FromFormat("%U%c", self->prefix, SEP);
             if (tmp == NULL)
                 goto error;
-            Py_SETREF(self->prefix, tmp);
+            Py_XSETREF(self->prefix, tmp);
         }
     }
     else
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c
--- a/Modules/zlibmodule.c
+++ b/Modules/zlibmodule.c
@@ -668,7 +668,7 @@
                       PyBytes_AS_STRING(self->unused_data), old_size);
             Py_MEMCPY(PyBytes_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;
         }
     }
@@ -680,7 +680,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;
 }
@@ -962,11 +962,11 @@
         goto error;
     }
     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);
     Py_XINCREF(self->zdict);
-    Py_SETREF(retval->zdict, self->zdict);
+    Py_XSETREF(retval->zdict, self->zdict);
     retval->eof = self->eof;
 
     /* Mark it as being initialized */
@@ -1018,11 +1018,11 @@
     }
 
     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);
     Py_XINCREF(self->zdict);
-    Py_SETREF(retval->zdict, self->zdict);
+    Py_XSETREF(retval->zdict, self->zdict);
     retval->eof = self->eof;
 
     /* Mark it as being initialized */
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -3520,7 +3520,7 @@
         /* Multiple references, need to create new object */
         PyObject *v;
         v = bytes_concat(*pv, w);
-        Py_SETREF(*pv, v);
+        Py_XSETREF(*pv, v);
     }
 }
 
diff --git a/Objects/descrobject.c b/Objects/descrobject.c
--- a/Objects/descrobject.c
+++ b/Objects/descrobject.c
@@ -1509,7 +1509,7 @@
         PyObject *get_doc = _PyObject_GetAttrId(get, &PyId___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
@@ -206,7 +206,7 @@
     seq = PySequence_Tuple(val);
     if (!seq)
         return -1;
-    Py_SETREF(self->args, seq);
+    Py_XSETREF(self->args, seq);
     return 0;
 }
 
@@ -235,7 +235,7 @@
     }
 
     Py_XINCREF(tb);
-    Py_SETREF(self->traceback, tb);
+    Py_XSETREF(self->traceback, tb);
     return 0;
 }
 
@@ -563,11 +563,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;
 }
@@ -628,7 +628,7 @@
     kwd = PyDict_GetItemString(kwds, #kwd); \
     if (kwd) { \
         Py_INCREF(kwd); \
-        Py_SETREF(self->kwd, kwd); \
+        Py_XSETREF(self->kwd, kwd); \
         if (PyDict_DelItemString(kwds, #kwd)) \
             return -1; \
     } \
@@ -647,7 +647,7 @@
         return -1;
 
     Py_INCREF(msg);
-    Py_SETREF(self->msg, msg);
+    Py_XSETREF(self->msg, msg);
 
     return 0;
 }
@@ -857,7 +857,7 @@
 #endif
 
     /* Steals the reference to args */
-    Py_SETREF(self->args, args);
+    Py_XSETREF(self->args, args);
     *p_args = args = NULL;
 
     return 0;
@@ -1277,7 +1277,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);
@@ -1293,16 +1293,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);
 
@@ -1547,7 +1547,7 @@
     PyObject *obj = PyUnicode_FromString(value);
     if (!obj)
         return -1;
-    Py_SETREF(*attr, obj);
+    Py_XSETREF(*attr, obj);
     return 0;
 }
 
@@ -1953,7 +1953,7 @@
         Py_buffer view;
         if (PyObject_GetBuffer(ude->object, &view, PyBUF_SIMPLE) != 0)
             goto error;
-        Py_SETREF(ude->object, PyBytes_FromStringAndSize(view.buf, view.len));
+        Py_XSETREF(ude->object, PyBytes_FromStringAndSize(view.buf, view.len));
         PyBuffer_Release(&view);
         if (!ude->object)
             goto error;
@@ -2862,7 +2862,7 @@
     }
     if (PyUnicode_Tailmatch(self->text, print_prefix,
                             start, text_len, -1)) {
-        Py_SETREF(self->msg,
+        Py_XSETREF(self->msg,
                   PyUnicode_FromString("Missing parentheses in call to 'print'"));
         return 1;
     }
@@ -2876,7 +2876,7 @@
     }
     if (PyUnicode_Tailmatch(self->text, exec_prefix,
                             start, text_len, -1)) {
-        Py_SETREF(self->msg,
+        Py_XSETREF(self->msg,
                   PyUnicode_FromString("Missing parentheses in call to 'exec'"));
         return 1;
     }
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -857,7 +857,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
@@ -127,7 +127,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;
 }
 
@@ -158,7 +158,7 @@
                         "non-dict keyword only default args");
         return -1;
     }
-    Py_SETREF(((PyFunctionObject *)op)->func_kwdefaults, defaults);
+    Py_XSETREF(((PyFunctionObject *)op)->func_kwdefaults, defaults);
     return 0;
 }
 
@@ -190,7 +190,7 @@
                      closure->ob_type->tp_name);
         return -1;
     }
-    Py_SETREF(((PyFunctionObject *)op)->func_closure, closure);
+    Py_XSETREF(((PyFunctionObject *)op)->func_closure, closure);
     return 0;
 }
 
@@ -221,7 +221,7 @@
                         "non-dict annotations");
         return -1;
     }
-    Py_SETREF(((PyFunctionObject *)op)->func_annotations, annotations);
+    Py_XSETREF(((PyFunctionObject *)op)->func_annotations, annotations);
     return 0;
 }
 
@@ -527,7 +527,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/moduleobject.c b/Objects/moduleobject.c
--- a/Objects/moduleobject.c
+++ b/Objects/moduleobject.c
@@ -69,7 +69,7 @@
         return -1;
     if (PyUnicode_CheckExact(name)) {
         Py_INCREF(name);
-        Py_SETREF(mod->md_name, name);
+        Py_XSETREF(mod->md_name, name);
     }
 
     return 0;
diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c
--- a/Objects/rangeobject.c
+++ b/Objects/rangeobject.c
@@ -1001,7 +1001,7 @@
         return NULL;
     cmp = PyObject_RichCompareBool(state, zero, Py_LT);
     if (cmp > 0) {
-        Py_SETREF(r->index, zero);
+        Py_XSETREF(r->index, zero);
         Py_RETURN_NONE;
     }
     Py_DECREF(zero);
@@ -1015,7 +1015,7 @@
         state = r->len;
 
     Py_INCREF(state);
-    Py_SETREF(r->index, state);
+    Py_XSETREF(r->index, state);
     Py_RETURN_NONE;
 }
 
@@ -1064,7 +1064,7 @@
     result = PyNumber_Add(r->start, product);
     Py_DECREF(product);
     if (result) {
-        Py_SETREF(r->index, new_index);
+        Py_XSETREF(r->index, new_index);
     }
     else {
         Py_DECREF(new_index);
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -316,7 +316,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);
@@ -424,7 +424,7 @@
 
     type->tp_name = tp_name;
     Py_INCREF(value);
-    Py_SETREF(((PyHeapTypeObject*)type)->ht_name, value);
+    Py_XSETREF(((PyHeapTypeObject*)type)->ht_name, value);
 
     return 0;
 }
@@ -445,7 +445,7 @@
 
     et = (PyHeapTypeObject*)type;
     Py_INCREF(value);
-    Py_SETREF(et->ht_qualname, value);
+    Py_XSETREF(et->ht_qualname, value);
     return 0;
 }
 
@@ -2897,7 +2897,7 @@
         else
             method_cache_misses++;
 #endif
-        Py_SETREF(method_cache[h].name, name);
+        Py_XSETREF(method_cache[h].name, name);
     }
     return res;
 }
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -1667,7 +1667,7 @@
         _Py_INCREF_UNICODE_EMPTY();
         if (!unicode_empty)
             return -1;
-        Py_SETREF(*p_unicode, unicode_empty);
+        Py_XSETREF(*p_unicode, unicode_empty);
         return 0;
     }
 
@@ -1675,7 +1675,7 @@
         PyObject *copy = resize_copy(unicode, length);
         if (copy == NULL)
             return -1;
-        Py_SETREF(*p_unicode, copy);
+        Py_XSETREF(*p_unicode, copy);
         return 0;
     }
 
@@ -13326,7 +13326,7 @@
             return -1;
         _PyUnicode_FastCopyCharacters(newbuffer, 0,
                                       writer->buffer, 0, writer->pos);
-        Py_SETREF(writer->buffer, newbuffer);
+        Py_XSETREF(writer->buffer, newbuffer);
     }
     _PyUnicodeWriter_Update(writer);
     return 0;
@@ -15012,7 +15012,7 @@
 
     if (t) {
         Py_INCREF(t);
-        Py_SETREF(*p, t);
+        Py_XSETREF(*p, t);
         return;
     }
 
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -526,7 +526,7 @@
         goto cleanup;
 
     readline = _PyObject_GetAttrId(stream, &PyId_readline);
-    Py_SETREF(tok->decoding_readline, readline);
+    Py_XSETREF(tok->decoding_readline, readline);
     if (pos > 0) {
         if (PyObject_CallObject(readline, NULL) == NULL) {
             readline = NULL;
diff --git a/Python/_warnings.c b/Python/_warnings.c
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -680,7 +680,7 @@
                     goto handle_error;
                 }
                 else if (!is_true) {
-                    Py_SETREF(*filename, PyUnicode_FromString("__main__"));
+                    Py_XSETREF(*filename, PyUnicode_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
@@ -3229,7 +3229,7 @@
                 Py_INCREF(self);
                 func = PyMethod_GET_FUNCTION(func);
                 Py_INCREF(func);
-                Py_SETREF(*pfunc, self);
+                Py_XSETREF(*pfunc, self);
                 na++;
                 /* n++; */
             } else
@@ -4426,7 +4426,7 @@
     PyThreadState *tstate = PyThreadState_GET();
 
     Py_XINCREF(wrapper);
-    Py_SETREF(tstate->coroutine_wrapper, wrapper);
+    Py_XSETREF(tstate->coroutine_wrapper, wrapper);
 }
 
 PyObject *
@@ -4682,7 +4682,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
@@ -1756,7 +1756,7 @@
     {
         /* use the class name for name mangling */
         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);
         /* load (global) __name__ ... */
         str = PyUnicode_InternFromString("__name__");
         if (!str || !compiler_nameop(c, str, Load)) {
diff --git a/Python/errors.c b/Python/errors.c
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -311,9 +311,9 @@
         --tstate->recursion_depth;
         /* throw away the old exception and use the recursion error instead */
         Py_INCREF(PyExc_RecursionError);
-        Py_SETREF(*exc, PyExc_RecursionError);
+        Py_XSETREF(*exc, PyExc_RecursionError);
         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