diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-04-10 15:12:01 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-04-10 15:12:01 (GMT) |
commit | f01e408c1688a207eba18444da8c151c872fba59 (patch) | |
tree | 3330812d856579add4526f10d5284164a15b6037 /Modules | |
parent | 47c5474aa0cbe8dc3cf2c370b19769edd3f2e8d8 (diff) | |
parent | 57a01d3a0ee20ee9eea69b658c6bac0f39541625 (diff) | |
download | cpython-f01e408c1688a207eba18444da8c151c872fba59.zip cpython-f01e408c1688a207eba18444da8c151c872fba59.tar.gz cpython-f01e408c1688a207eba18444da8c151c872fba59.tar.bz2 |
Issue #26200: Added Py_SETREF and replaced Py_XSETREF with Py_SETREF
in places where Py_DECREF was used.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_ctypes/_ctypes.c | 14 | ||||
-rw-r--r-- | Modules/_curses_panel.c | 2 | ||||
-rw-r--r-- | Modules/_datetimemodule.c | 6 | ||||
-rw-r--r-- | Modules/_elementtree.c | 8 | ||||
-rw-r--r-- | Modules/_io/bytesio.c | 2 | ||||
-rw-r--r-- | Modules/_sqlite/connection.c | 6 | ||||
-rw-r--r-- | Modules/_sqlite/cursor.c | 6 | ||||
-rw-r--r-- | Modules/_sre.c | 2 | ||||
-rw-r--r-- | Modules/_ssl.c | 2 | ||||
-rw-r--r-- | Modules/itertoolsmodule.c | 4 | ||||
-rw-r--r-- | Modules/signalmodule.c | 2 | ||||
-rw-r--r-- | Modules/zipimport.c | 2 | ||||
-rw-r--r-- | Modules/zlibmodule.c | 4 |
13 files changed, 30 insertions, 30 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index 2bf088a..060dca5 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -391,7 +391,7 @@ StructUnionType_new(PyTypeObject *type, PyObject *args, PyObject *kwds, int isSt Py_DECREF((PyObject *)dict); return NULL; } - Py_XSETREF(result->tp_dict, (PyObject *)dict); + Py_SETREF(result->tp_dict, (PyObject *)dict); dict->format = _ctypes_alloc_format_string(NULL, "B"); if (dict->format == NULL) { Py_DECREF(result); @@ -960,7 +960,7 @@ PyCPointerType_new(PyTypeObject *type, PyObject *args, PyObject *kwds) Py_DECREF((PyObject *)stgdict); return NULL; } - Py_XSETREF(result->tp_dict, (PyObject *)stgdict); + Py_SETREF(result->tp_dict, (PyObject *)stgdict); return (PyObject *)result; } @@ -1403,7 +1403,7 @@ PyCArrayType_new(PyTypeObject *type, PyObject *args, PyObject *kwds) /* replace the class dict by our updated spam dict */ if (-1 == PyDict_Update((PyObject *)stgdict, result->tp_dict)) goto error; - Py_XSETREF(result->tp_dict, (PyObject *)stgdict); /* steal the reference */ + Py_SETREF(result->tp_dict, (PyObject *)stgdict); /* steal the reference */ stgdict = NULL; /* Special case for character arrays. @@ -1816,7 +1816,7 @@ static PyObject *CreateSwappedType(PyTypeObject *type, PyObject *args, PyObject Py_DECREF((PyObject *)stgdict); return NULL; } - Py_XSETREF(result->tp_dict, (PyObject *)stgdict); + Py_SETREF(result->tp_dict, (PyObject *)stgdict); return (PyObject *)result; } @@ -1944,7 +1944,7 @@ PyCSimpleType_new(PyTypeObject *type, PyObject *args, PyObject *kwds) Py_DECREF((PyObject *)stgdict); return NULL; } - Py_XSETREF(result->tp_dict, (PyObject *)stgdict); + Py_SETREF(result->tp_dict, (PyObject *)stgdict); /* Install from_param class methods in ctypes base classes. Overrides the PyCSimpleType_from_param generic method. @@ -2307,7 +2307,7 @@ PyCFuncPtrType_new(PyTypeObject *type, PyObject *args, PyObject *kwds) Py_DECREF((PyObject *)stgdict); return NULL; } - Py_XSETREF(result->tp_dict, (PyObject *)stgdict); + Py_SETREF(result->tp_dict, (PyObject *)stgdict); if (-1 == make_funcptrtype_dict(stgdict)) { Py_DECREF(result); @@ -5150,7 +5150,7 @@ comerror_init(PyObject *self, PyObject *args, PyObject *kwds) return -1; Py_INCREF(args); - Py_XSETREF(((PyBaseExceptionObject *)self)->args, args); + Py_SETREF(((PyBaseExceptionObject *)self)->args, args); return 0; } diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c index 9ed2a4c..26bf094 100644 --- a/Modules/_curses_panel.c +++ b/Modules/_curses_panel.c @@ -313,7 +313,7 @@ PyCursesPanel_replace_panel(PyCursesPanelObject *self, PyObject *args) return NULL; } Py_INCREF(temp); - Py_XSETREF(po->wo, temp); + Py_SETREF(po->wo, temp); Py_INCREF(Py_None); return Py_None; } diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c index e5191a0..261c4bc 100644 --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -1058,7 +1058,7 @@ format_utcoffset(char *buf, size_t buflen, const char *sep, /* Offset is normalized, so it is negative if days < 0 */ if (GET_TD_DAYS(offset) < 0) { sign = '-'; - Py_XSETREF(offset, delta_negative((PyDateTime_Delta *)offset)); + Py_SETREF(offset, delta_negative((PyDateTime_Delta *)offset)); if (offset == NULL) return -1; } @@ -3045,7 +3045,7 @@ tzinfo_fromutc(PyDateTime_TZInfo *self, PyObject *dt) if (dst == Py_None) goto Inconsistent; if (delta_bool((PyDateTime_Delta *)dst) != 0) { - Py_XSETREF(result, add_datetime_timedelta((PyDateTime_DateTime *)result, + Py_SETREF(result, add_datetime_timedelta((PyDateTime_DateTime *)result, (PyDateTime_Delta *)dst, 1)); if (result == NULL) goto Fail; @@ -4445,7 +4445,7 @@ datetime_subtract(PyObject *left, PyObject *right) return NULL; if (offdiff != NULL) { - Py_XSETREF(result, delta_subtract(result, offdiff)); + Py_SETREF(result, delta_subtract(result, offdiff)); Py_DECREF(offdiff); } } diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index 5c49c15..63639c7 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -1957,7 +1957,7 @@ element_tag_setter(ElementObject *self, PyObject *value, void *closure) { _VALIDATE_ATTR_VALUE(value); Py_INCREF(value); - Py_XSETREF(self->tag, value); + Py_SETREF(self->tag, value); return 0; } @@ -1990,7 +1990,7 @@ element_attrib_setter(ElementObject *self, PyObject *value, void *closure) return -1; } Py_INCREF(value); - Py_XSETREF(self->extra->attrib, value); + Py_SETREF(self->extra->attrib, value); return 0; } @@ -2524,9 +2524,9 @@ treebuilder_handle_start(TreeBuilderObject* self, PyObject* tag, self->index++; Py_INCREF(node); - Py_XSETREF(self->this, node); + Py_SETREF(self->this, node); Py_INCREF(node); - Py_XSETREF(self->last, node); + Py_SETREF(self->last, node); if (treebuilder_append_event(self, self->start_event_obj, node) < 0) goto error; diff --git a/Modules/_io/bytesio.c b/Modules/_io/bytesio.c index 84d2c5d..ca3a639 100644 --- a/Modules/_io/bytesio.c +++ b/Modules/_io/bytesio.c @@ -96,7 +96,7 @@ unshare_buffer(bytesio *self, size_t size) return -1; memcpy(PyBytes_AS_STRING(new_buf), PyBytes_AS_STRING(self->buf), self->string_size); - Py_XSETREF(self->buf, new_buf); + Py_SETREF(self->buf, new_buf); return 0; } diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index f634877..4beed78 100644 --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -204,7 +204,7 @@ void pysqlite_flush_statement_cache(pysqlite_Connection* self) node = node->next; } - Py_XSETREF(self->statement_cache, + Py_SETREF(self->statement_cache, (pysqlite_Cache *)PyObject_CallFunction((PyObject *)&pysqlite_CacheType, "O", self)); Py_DECREF(self); self->statement_cache->decref_factory = 0; @@ -793,7 +793,7 @@ static void _pysqlite_drop_unused_statement_references(pysqlite_Connection* self } } - Py_XSETREF(self->statements, new_list); + Py_SETREF(self->statements, new_list); } static void _pysqlite_drop_unused_cursor_references(pysqlite_Connection* self) @@ -824,7 +824,7 @@ static void _pysqlite_drop_unused_cursor_references(pysqlite_Connection* self) } } - Py_XSETREF(self->cursors, new_list); + Py_SETREF(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 index 552c8bb..23f3057 100644 --- a/Modules/_sqlite/cursor.c +++ b/Modules/_sqlite/cursor.c @@ -509,7 +509,7 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* /* reset description and rowcount */ Py_INCREF(Py_None); - Py_XSETREF(self->description, Py_None); + Py_SETREF(self->description, Py_None); self->rowcount = -1L; func_args = PyTuple_New(1); @@ -534,7 +534,7 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* } if (self->statement->in_use) { - Py_XSETREF(self->statement, + Py_SETREF(self->statement, PyObject_New(pysqlite_Statement, &pysqlite_StatementType)); if (!self->statement) { goto error; @@ -651,7 +651,7 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* numcols = sqlite3_column_count(self->statement->st); Py_END_ALLOW_THREADS - Py_XSETREF(self->description, PyTuple_New(numcols)); + Py_SETREF(self->description, PyTuple_New(numcols)); if (!self->description) { goto error; } diff --git a/Modules/_sre.c b/Modules/_sre.c index ab8a17e..fb0ab03 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -753,7 +753,7 @@ deepcopy(PyObject** object, PyObject* memo) if (!copy) return 0; - Py_XSETREF(*object, copy); + Py_SETREF(*object, copy); return 1; /* success */ } diff --git a/Modules/_ssl.c b/Modules/_ssl.c index e6e98cd..994198c 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -1589,7 +1589,7 @@ static int PySSL_set_context(PySSLSocket *self, PyObject *value, return -1; #else Py_INCREF(value); - Py_XSETREF(self->ctx, (PySSLContext *)value); + Py_SETREF(self->ctx, (PySSLContext *)value); SSL_set_SSL_CTX(self->ssl, self->ctx->ctx); #endif } else { diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c index 532ce01..1d550fa 100644 --- a/Modules/itertoolsmodule.c +++ b/Modules/itertoolsmodule.c @@ -622,7 +622,7 @@ tee_next(teeobject *to) link = teedataobject_jumplink(to->dataobj); if (link == NULL) return NULL; - Py_XSETREF(to->dataobj, (teedataobject *)link); + Py_SETREF(to->dataobj, (teedataobject *)link); to->index = 0; } value = teedataobject_getitem(to->dataobj, to->index); @@ -3457,7 +3457,7 @@ accumulate_next(accumulateobject *lz) return NULL; Py_INCREF(newtotal); - Py_XSETREF(lz->total, newtotal); + Py_SETREF(lz->total, newtotal); return newtotal; } diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index 3edf158..da454de 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -1266,7 +1266,7 @@ PyInit__signal(void) if (Handlers[SIGINT].func == DefaultHandler) { /* Install default int handler */ Py_INCREF(IntHandler); - Py_XSETREF(Handlers[SIGINT].func, IntHandler); + Py_SETREF(Handlers[SIGINT].func, IntHandler); old_siginthandler = PyOS_setsig(SIGINT, signal_handler); } diff --git a/Modules/zipimport.c b/Modules/zipimport.c index 3abb9f0..e840271 100644 --- a/Modules/zipimport.c +++ b/Modules/zipimport.c @@ -155,7 +155,7 @@ zipimporter_init(ZipImporter *self, PyObject *args, PyObject *kwds) tmp = PyUnicode_FromFormat("%U%c", self->prefix, SEP); if (tmp == NULL) goto error; - Py_XSETREF(self->prefix, tmp); + Py_SETREF(self->prefix, tmp); } } else diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c index 04485ee..618a22d 100644 --- a/Modules/zlibmodule.c +++ b/Modules/zlibmodule.c @@ -667,7 +667,7 @@ save_unconsumed_input(compobject *self, int err) 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_XSETREF(self->unused_data, new_data); + Py_SETREF(self->unused_data, new_data); self->zst.avail_in = 0; } } @@ -679,7 +679,7 @@ save_unconsumed_input(compobject *self, int err) (char *)self->zst.next_in, self->zst.avail_in); if (new_data == NULL) return -1; - Py_XSETREF(self->unconsumed_tail, new_data); + Py_SETREF(self->unconsumed_tail, new_data); } return 0; } |