diff -r 06772ba3d001 Mac/Modules/carbonevt/_CarbonEvtmodule.c --- a/Mac/Modules/carbonevt/_CarbonEvtmodule.c Thu Oct 04 22:52:07 2012 +0300 +++ b/Mac/Modules/carbonevt/_CarbonEvtmodule.c Fri Nov 09 02:14:14 2012 +0100 @@ -1051,8 +1051,11 @@ static PyObject *EventHandlerRef_RemoveE _err = RemoveEventHandler(_self->ob_itself); if (_err != noErr) return PyMac_Error(_err); _self->ob_itself = NULL; - Py_DECREF(_self->ob_callback); - _self->ob_callback = NULL; + { + PyObject *tmp = _self->ob_callback; + _self->ob_callback = NULL; + Py_DECREF(tmp); + } Py_INCREF(Py_None); _res = Py_None; return _res; diff -r 06772ba3d001 Mac/Modules/list/_Listmodule.c --- a/Mac/Modules/list/_Listmodule.c Thu Oct 04 22:52:07 2012 +0300 +++ b/Mac/Modules/list/_Listmodule.c Fri Nov 09 02:14:14 2012 +0100 @@ -76,8 +76,11 @@ int ListObj_Convert(PyObject *v, ListHan static void ListObj_dealloc(ListObject *self) { - Py_XDECREF(self->ob_ldef_func); - self->ob_ldef_func = NULL; + { + PyObject *tmp = self->ob_ldef_func; + self->ob_ldef_func = NULL; + Py_XDECREF(tmp); + } SetListRefCon(self->ob_itself, (long)0); if (self->ob_must_be_disposed && self->ob_itself) LDispose(self->ob_itself); self->ob_type->tp_free((PyObject *)self); diff -r 06772ba3d001 Modules/_bsddb.c --- a/Modules/_bsddb.c Thu Oct 04 22:52:07 2012 +0300 +++ b/Modules/_bsddb.c Fri Nov 09 02:14:14 2012 +0100 @@ -984,8 +984,11 @@ newDBObject(DBEnvObject* arg, int flags) * DBTxns and closing any open DBs first. */ if (makeDBError(err)) { if (self->myenvobj) { - Py_DECREF(self->myenvobj); - self->myenvobj = NULL; + { + PyObject *tmp = self->myenvobj; + self->myenvobj = NULL; + Py_DECREF(tmp); + } } Py_DECREF(self); self = NULL; @@ -1017,16 +1020,25 @@ DB_dealloc(DBObject* self) PyObject_ClearWeakRefs((PyObject *) self); } if (self->myenvobj) { - Py_DECREF(self->myenvobj); - self->myenvobj = NULL; + { + PyObject *tmp = self->myenvobj; + self->myenvobj = NULL; + Py_DECREF(tmp); + } } if (self->associateCallback != NULL) { - Py_DECREF(self->associateCallback); - self->associateCallback = NULL; + { + PyObject *tmp = self->associateCallback; + self->associateCallback = NULL; + Py_DECREF(tmp); + } } if (self->btCompareCallback != NULL) { - Py_DECREF(self->btCompareCallback); - self->btCompareCallback = NULL; + { + PyObject *tmp = self->btCompareCallback; + self->btCompareCallback = NULL; + Py_DECREF(tmp); + } } Py_DECREF(self->private_obj); PyObject_Del(self); @@ -1188,8 +1200,11 @@ DBEnv_dealloc(DBEnvObject* self) PyErr_Clear(); } - Py_XDECREF(self->event_notifyCallback); - self->event_notifyCallback = NULL; + { + PyObject *tmp = self->event_notifyCallback; + self->event_notifyCallback = NULL; + Py_XDECREF(tmp); + } if (self->in_weakreflist != NULL) { PyObject_ClearWeakRefs((PyObject *) self); @@ -1622,8 +1637,11 @@ DB_associate(DBObject* self, PyObject* a MYDB_END_ALLOW_THREADS; if (err) { - Py_XDECREF(secondaryDB->associateCallback); - secondaryDB->associateCallback = NULL; + { + PyObject *tmp = secondaryDB->associateCallback; + secondaryDB->associateCallback = NULL; + Py_XDECREF(tmp); + } secondaryDB->primaryDBType = 0; } diff -r 06772ba3d001 Modules/_csv.c --- a/Modules/_csv.c Thu Oct 04 22:52:07 2012 +0300 +++ b/Modules/_csv.c Fri Nov 09 02:14:14 2012 +0100 @@ -764,8 +764,11 @@ parse_process_char(ReaderObj *self, char static int parse_reset(ReaderObj *self) { - Py_XDECREF(self->fields); - self->fields = PyList_New(0); + { + PyObject *tmp = self->fields; + self->fields = PyList_New(0); + Py_XDECREF(tmp); + } if (self->fields == NULL) return -1; self->field_len = 0; diff -r 06772ba3d001 Modules/_ctypes/_ctypes.c --- a/Modules/_ctypes/_ctypes.c Thu Oct 04 22:52:07 2012 +0300 +++ b/Modules/_ctypes/_ctypes.c Fri Nov 09 02:14:14 2012 +0100 @@ -194,10 +194,16 @@ static PyObject * if (-1 == PyDict_DelItem(self->dict, self->key)) /* XXX Error context */ PyErr_WriteUnraisable(Py_None); - Py_DECREF(self->key); - self->key = NULL; - Py_DECREF(self->dict); - self->dict = NULL; + { + PyObject *tmp = self->key; + self->key = NULL; + Py_DECREF(tmp); + } + { + PyObject *tmp = self->dict; + self->dict = NULL; + Py_DECREF(tmp); + } } Py_INCREF(Py_None); return Py_None; @@ -384,8 +390,11 @@ StructUnionType_new(PyTypeObject *type, Py_DECREF((PyObject *)dict); return NULL; } - Py_DECREF(result->tp_dict); - result->tp_dict = (PyObject *)dict; + { + PyObject *tmp = result->tp_dict; + result->tp_dict = (PyObject *)dict; + Py_DECREF(tmp); + } dict->format = _ctypes_alloc_format_string(NULL, "B"); if (dict->format == NULL) { Py_DECREF(result); @@ -863,8 +872,11 @@ PyCPointerType_SetProto(StgDictObject *s return -1; } Py_INCREF(proto); - Py_XDECREF(stgdict->proto); - stgdict->proto = proto; + { + PyObject *tmp = stgdict->proto; + stgdict->proto = proto; + Py_XDECREF(tmp); + } return 0; } @@ -947,8 +959,11 @@ PyCPointerType_new(PyTypeObject *type, P Py_DECREF((PyObject *)stgdict); return NULL; } - Py_DECREF(result->tp_dict); - result->tp_dict = (PyObject *)stgdict; + { + PyObject *tmp = result->tp_dict; + result->tp_dict = (PyObject *)stgdict; + Py_DECREF(tmp); + } return (PyObject *)result; } @@ -1420,8 +1435,11 @@ PyCArrayType_new(PyTypeObject *type, PyO Py_DECREF((PyObject *)stgdict); return NULL; } - Py_DECREF(result->tp_dict); - result->tp_dict = (PyObject *)stgdict; + { + PyObject *tmp = result->tp_dict; + result->tp_dict = (PyObject *)stgdict; + Py_DECREF(tmp); + } /* Special case for character arrays. A permanent annoyance: char arrays are also strings! @@ -1844,8 +1862,11 @@ static PyObject *CreateSwappedType(PyTyp Py_DECREF((PyObject *)stgdict); return NULL; } - Py_DECREF(result->tp_dict); - result->tp_dict = (PyObject *)stgdict; + { + PyObject *tmp = result->tp_dict; + result->tp_dict = (PyObject *)stgdict; + Py_DECREF(tmp); + } return (PyObject *)result; } @@ -2353,8 +2374,11 @@ PyCFuncPtrType_new(PyTypeObject *type, P Py_DECREF((PyObject *)stgdict); return NULL; } - Py_DECREF(result->tp_dict); - result->tp_dict = (PyObject *)stgdict; + { + PyObject *tmp = result->tp_dict; + result->tp_dict = (PyObject *)stgdict; + Py_DECREF(tmp); + } if (-1 == make_funcptrtype_dict(stgdict)) { Py_DECREF(result); @@ -2496,8 +2520,11 @@ KeepRef(CDataObject *target, Py_ssize_t } ob = PyCData_GetContainer(target); if (ob->b_objects == NULL || !PyDict_CheckExact(ob->b_objects)) { - Py_XDECREF(ob->b_objects); - ob->b_objects = keep; /* refcount consumed */ + { + PyObject *tmp = ob->b_objects; + ob->b_objects = keep; + Py_XDECREF(tmp); + } /* refcount consumed */ return 0; } key = unique_key(target, index); @@ -3042,10 +3069,16 @@ static int PyCFuncPtr_set_restype(PyCFuncPtrObject *self, PyObject *ob) { if (ob == NULL) { - Py_XDECREF(self->restype); - self->restype = NULL; - Py_XDECREF(self->checker); - self->checker = NULL; + { + PyObject *tmp = self->restype; + self->restype = NULL; + Py_XDECREF(tmp); + } + { + PyObject *tmp = self->checker; + self->checker = NULL; + Py_XDECREF(tmp); + } return 0; } if (ob != Py_None && !PyType_stgdict(ob) && !PyCallable_Check(ob)) { @@ -3088,16 +3121,25 @@ PyCFuncPtr_set_argtypes(PyCFuncPtrObject PyObject *converters; if (ob == NULL || ob == Py_None) { - Py_XDECREF(self->converters); - self->converters = NULL; - Py_XDECREF(self->argtypes); - self->argtypes = NULL; + { + PyObject *tmp = self->converters; + self->converters = NULL; + Py_XDECREF(tmp); + } + { + PyObject *tmp = self->argtypes; + self->argtypes = NULL; + Py_XDECREF(tmp); + } } else { converters = converters_from_argtypes(ob); if (!converters) return -1; - Py_XDECREF(self->converters); - self->converters = converters; + { + PyObject *tmp = self->converters; + self->converters = converters; + Py_XDECREF(tmp); + } Py_XDECREF(self->argtypes); Py_INCREF(ob); self->argtypes = ob; diff -r 06772ba3d001 Modules/_curses_panel.c --- a/Modules/_curses_panel.c Thu Oct 04 22:52:07 2012 +0300 +++ b/Modules/_curses_panel.c Fri Nov 09 02:14:14 2012 +0100 @@ -283,8 +283,11 @@ PyCursesPanel_replace_panel(PyCursesPane PyErr_SetString(PyCursesError, "replace_panel() returned ERR"); return NULL; } - Py_DECREF(po->wo); - po->wo = temp; + { + PyObject *tmp = po->wo; + po->wo = temp; + Py_DECREF(tmp); + } Py_INCREF(po->wo); Py_INCREF(Py_None); return Py_None; diff -r 06772ba3d001 Modules/_elementtree.c --- a/Modules/_elementtree.c Thu Oct 04 22:52:07 2012 +0300 +++ b/Modules/_elementtree.c Fri Nov 09 02:14:14 2012 +0100 @@ -665,14 +665,20 @@ element_deepcopy(ElementObject* self, Py text = deepcopy(JOIN_OBJ(self->text), memo); if (!text) goto error; - Py_DECREF(element->text); - element->text = JOIN_SET(text, JOIN_GET(self->text)); + { + PyObject *tmp = element->text; + element->text = JOIN_SET(text, JOIN_GET(self->text)); + Py_DECREF(tmp); + } tail = deepcopy(JOIN_OBJ(self->tail), memo); if (!tail) goto error; - Py_DECREF(element->tail); - element->tail = JOIN_SET(tail, JOIN_GET(self->tail)); + { + PyObject *tmp = element->tail; + element->tail = JOIN_SET(tail, JOIN_GET(self->tail)); + Py_DECREF(tmp); + } if (self->extra) { @@ -1541,8 +1547,11 @@ element_setattr(ElementObject* self, con } if (strcmp(name, "tag") == 0) { - Py_DECREF(self->tag); - self->tag = value; + { + PyObject *tmp = self->tag; + self->tag = value; + Py_DECREF(tmp); + } Py_INCREF(self->tag); } else if (strcmp(name, "text") == 0) { Py_DECREF(JOIN_OBJ(self->text)); @@ -1848,9 +1857,11 @@ treebuilder_handle_end(TreeBuilderObject item = PyList_GET_ITEM(self->stack, self->index); Py_INCREF(item); - Py_DECREF(self->last); - - self->last = (ElementObject*) self->this; + { + PyObject *tmp = self->last; + self->last = (ElementObject *)self->this; + Py_DECREF(tmp); + } self->this = (ElementObject*) item; if (self->end_event_obj) { @@ -2730,14 +2741,33 @@ xmlparser_setevents(XMLParserObject* sel target = (TreeBuilderObject*) self->target; Py_INCREF(events); - Py_XDECREF(target->events); - target->events = events; + { + PyObject *tmp = target->events; + target->events = events; + Py_XDECREF(tmp); + } /* clear out existing events */ - Py_XDECREF(target->start_event_obj); target->start_event_obj = NULL; - Py_XDECREF(target->end_event_obj); target->end_event_obj = NULL; - Py_XDECREF(target->start_ns_event_obj); target->start_ns_event_obj = NULL; - Py_XDECREF(target->end_ns_event_obj); target->end_ns_event_obj = NULL; + { + PyObject *tmp = target->start_event_obj; + target->start_event_obj = NULL; + Py_XDECREF(tmp); + } + { + PyObject *tmp = target->end_event_obj; + target->end_event_obj = NULL; + Py_XDECREF(tmp); + } + { + PyObject *tmp = target->start_ns_event_obj; + target->start_ns_event_obj = NULL; + Py_XDECREF(tmp); + } + { + PyObject *tmp = target->end_ns_event_obj; + target->end_ns_event_obj = NULL; + Py_XDECREF(tmp); + } if (event_set == Py_None) { /* default is "end" only */ @@ -2759,12 +2789,18 @@ xmlparser_setevents(XMLParserObject* sel target->start_event_obj = item; } else if (strcmp(event, "end") == 0) { Py_INCREF(item); - Py_XDECREF(target->end_event_obj); - target->end_event_obj = item; + { + PyObject *tmp = target->end_event_obj; + target->end_event_obj = item; + Py_XDECREF(tmp); + } } else if (strcmp(event, "start-ns") == 0) { Py_INCREF(item); - Py_XDECREF(target->start_ns_event_obj); - target->start_ns_event_obj = item; + { + PyObject *tmp = target->start_ns_event_obj; + target->start_ns_event_obj = item; + Py_XDECREF(tmp); + } EXPAT(SetNamespaceDeclHandler)( self->parser, (XML_StartNamespaceDeclHandler) expat_start_ns_handler, @@ -2772,8 +2808,11 @@ xmlparser_setevents(XMLParserObject* sel ); } else if (strcmp(event, "end-ns") == 0) { Py_INCREF(item); - Py_XDECREF(target->end_ns_event_obj); - target->end_ns_event_obj = item; + { + PyObject *tmp = target->end_ns_event_obj; + target->end_ns_event_obj = item; + Py_XDECREF(tmp); + } EXPAT(SetNamespaceDeclHandler)( self->parser, (XML_StartNamespaceDeclHandler) expat_start_ns_handler, diff -r 06772ba3d001 Modules/_json.c --- a/Modules/_json.c Thu Oct 04 22:52:07 2012 +0300 +++ b/Modules/_json.c Fri Nov 09 02:14:14 2012 +0100 @@ -1722,8 +1722,11 @@ scanner_init(PyObject *self, PyObject *a } else if (PyUnicode_Check(s->encoding)) { PyObject *tmp = PyUnicode_AsEncodedString(s->encoding, NULL, NULL); - Py_DECREF(s->encoding); - s->encoding = tmp; + { + PyObject *tmp = s->encoding; + s->encoding = tmp; + Py_DECREF(tmp); + } } if (s->encoding == NULL) goto bail; diff -r 06772ba3d001 Modules/_sqlite/connection.c --- a/Modules/_sqlite/connection.c Thu Oct 04 22:52:07 2012 +0300 +++ b/Modules/_sqlite/connection.c Fri Nov 09 02:14:14 2012 +0100 @@ -225,8 +225,11 @@ void pysqlite_flush_statement_cache(pysq node = node->next; } - Py_DECREF(self->statement_cache); - self->statement_cache = (pysqlite_Cache*)PyObject_CallFunction((PyObject*)&pysqlite_CacheType, "O", self); + { + PyObject *tmp = self->statement_cache; + self->statement_cache = (pysqlite_Cache *)PyObject_CallFunction((PyObject *)&pysqlite_CacheType, "O", self); + Py_DECREF(tmp); + } Py_DECREF(self); self->statement_cache->decref_factory = 0; } @@ -366,8 +369,11 @@ PyObject* pysqlite_connection_close(pysq if (self->apsw_connection) { ret = PyObject_CallMethod(self->apsw_connection, "close", ""); Py_XDECREF(ret); - Py_XDECREF(self->apsw_connection); - self->apsw_connection = NULL; + { + PyObject *tmp = self->apsw_connection; + self->apsw_connection = NULL; + Py_XDECREF(tmp); + } self->db = NULL; } else { Py_BEGIN_ALLOW_THREADS @@ -812,8 +818,11 @@ static void _pysqlite_drop_unused_statem } } - Py_DECREF(self->statements); - self->statements = new_list; + { + PyObject *tmp = self->statements; + self->statements = new_list; + Py_DECREF(tmp); + } } static void _pysqlite_drop_unused_cursor_references(pysqlite_Connection* self) @@ -844,8 +853,11 @@ static void _pysqlite_drop_unused_cursor } } - Py_DECREF(self->cursors); - self->cursors = new_list; + { + PyObject *tmp = self->cursors; + self->cursors = new_list; + Py_DECREF(tmp); + } } PyObject* pysqlite_connection_create_function(pysqlite_Connection* self, PyObject* args, PyObject* kwargs) diff -r 06772ba3d001 Modules/_sqlite/cursor.c --- a/Modules/_sqlite/cursor.c Thu Oct 04 22:52:07 2012 +0300 +++ b/Modules/_sqlite/cursor.c Fri Nov 09 02:14:14 2012 +0100 @@ -180,8 +180,11 @@ int pysqlite_build_row_cast_map(pysqlite return 0; } - Py_XDECREF(self->row_cast_map); - self->row_cast_map = PyList_New(0); + { + PyObject *tmp = self->row_cast_map; + self->row_cast_map = PyList_New(0); + Py_XDECREF(tmp); + } for (i = 0; i < sqlite3_column_count(self->statement->st); i++) { converter = NULL; @@ -239,8 +242,11 @@ int pysqlite_build_row_cast_map(pysqlite if (converter != Py_None) { Py_DECREF(converter); } - Py_XDECREF(self->row_cast_map); - self->row_cast_map = NULL; + { + PyObject *tmp = self->row_cast_map; + self->row_cast_map = NULL; + Py_XDECREF(tmp); + } return -1; } @@ -483,8 +489,11 @@ PyObject* _pysqlite_query_execute(pysqli allow_8bit_chars = ((self->connection->text_factory != (PyObject*)&PyUnicode_Type) && (self->connection->text_factory != pysqlite_OptimizedUnicode)); - Py_XDECREF(self->next_row); - self->next_row = NULL; + { + PyObject *tmp = self->next_row; + self->next_row = NULL; + Py_XDECREF(tmp); + } if (multiple) { /* executemany() */ @@ -588,8 +597,11 @@ PyObject* _pysqlite_query_execute(pysqli } if (self->statement->in_use) { - Py_DECREF(self->statement); - self->statement = PyObject_New(pysqlite_Statement, &pysqlite_StatementType); + { + PyObject *tmp = self->statement; + self->statement = PyObject_New(pysqlite_Statement, &pysqlite_StatementType); + Py_DECREF(tmp); + } if (!self->statement) { goto error; } @@ -700,8 +712,11 @@ PyObject* _pysqlite_query_execute(pysqli numcols = sqlite3_column_count(self->statement->st); Py_END_ALLOW_THREADS - Py_DECREF(self->description); - self->description = PyTuple_New(numcols); + { + PyObject *tmp = self->description; + self->description = PyTuple_New(numcols); + Py_DECREF(tmp); + } if (!self->description) { goto error; } @@ -910,8 +925,11 @@ PyObject* pysqlite_cursor_iternext(pysql if (!self->next_row) { if (self->statement) { (void)pysqlite_statement_reset(self->statement); - Py_DECREF(self->statement); - self->statement = NULL; + { + PyObject *tmp = self->statement; + self->statement = NULL; + Py_DECREF(tmp); + } } return NULL; } diff -r 06772ba3d001 Modules/bz2module.c --- a/Modules/bz2module.c Thu Oct 04 22:52:07 2012 +0300 +++ b/Modules/bz2module.c Fri Nov 09 02:14:14 2012 +0100 @@ -1936,10 +1936,11 @@ BZ2Decomp_decompress(BZ2DecompObject *se Py_END_ALLOW_THREADS if (bzerror == BZ_STREAM_END) { if (bzs->avail_in != 0) { - Py_DECREF(self->unused_data); - self->unused_data = - PyString_FromStringAndSize(bzs->next_in, - bzs->avail_in); + { + PyObject *tmp = self->unused_data; + self->unused_data = PyString_FromStringAndSize(bzs->next_in, bzs->avail_in); + Py_DECREF(tmp); + } } self->running = 0; break; diff -r 06772ba3d001 Modules/cPickle.c --- a/Modules/cPickle.c Thu Oct 04 22:52:07 2012 +0300 +++ b/Modules/cPickle.c Fri Nov 09 02:14:14 2012 +0100 @@ -325,8 +325,11 @@ Pdata_popList(Pdata *self, int start) #define FREE_ARG_TUP(self) { \ if (Py_REFCNT(self->arg) > 1) { \ - Py_DECREF(self->arg); \ - self->arg=NULL; \ + { +PyObject *tmp = self->arg; +self->arg = NULL; +Py_DECREF(tmp); +} \ } \ } @@ -659,8 +662,11 @@ read_other(Unpicklerobject *self, char * } if (! str) return -1; - Py_XDECREF(self->last_string); - self->last_string = str; + { + PyObject *tmp = self->last_string; + self->last_string = str; + Py_XDECREF(tmp); + } if (! (*s = PyString_AsString(str))) return -1; @@ -686,8 +692,11 @@ readline_other(Unpicklerobject *self, ch if ((str_size = PyString_Size(str)) < 0) return -1; - Py_XDECREF(self->last_string); - self->last_string = str; + { + PyObject *tmp = self->last_string; + self->last_string = str; + Py_XDECREF(tmp); + } if (! (*s = PyString_AsString(str))) return -1; @@ -5597,15 +5606,21 @@ Unpickler_setattr(Unpicklerobject *self, { if (!strcmp(name, "persistent_load")) { - Py_XDECREF(self->pers_func); + { + PyObject *tmp = self->pers_func; self->pers_func = value; + Py_XDECREF(tmp); + } Py_XINCREF(value); return 0; } if (!strcmp(name, "find_global")) { - Py_XDECREF(self->find_class); + { + PyObject *tmp = self->find_class; self->find_class = value; + Py_XDECREF(tmp); + } Py_XINCREF(value); return 0; } @@ -5622,8 +5637,11 @@ Unpickler_setattr(Unpicklerobject *self, "memo must be a dictionary"); return -1; } - Py_XDECREF(self->memo); + { + PyObject *tmp = self->memo; self->memo = value; + Py_XDECREF(tmp); + } Py_INCREF(value); return 0; } diff -r 06772ba3d001 Modules/flmodule.c --- a/Modules/flmodule.c Thu Oct 04 22:52:07 2012 +0300 +++ b/Modules/flmodule.c Fri Nov 09 02:14:14 2012 +0100 @@ -97,10 +97,16 @@ forgetgeneric(genericobject *g) { int i, n; - Py_XDECREF(g->ob_callback); - g->ob_callback = NULL; - Py_XDECREF(g->ob_callback_arg); - g->ob_callback_arg = NULL; + { + PyObject *tmp = g->ob_callback; + g->ob_callback = NULL; + Py_XDECREF(tmp); + } + { + PyObject *tmp = g->ob_callback_arg; + g->ob_callback_arg = NULL; + Py_XDECREF(tmp); + } if (allgenerics == NULL) return; /* No objects known yet */ n = PyList_Size(allgenerics); @@ -132,10 +138,16 @@ releaseobjects(FL_FORM *form) /* The object is now unreachable for do_forms and check_forms, so delete it from the list of known objects */ - Py_XDECREF(g->ob_callback); - g->ob_callback = NULL; - Py_XDECREF(g->ob_callback_arg); - g->ob_callback_arg = NULL; + { + PyObject *tmp = g->ob_callback; + g->ob_callback = NULL; + Py_XDECREF(tmp); + } + { + PyObject *tmp = g->ob_callback_arg; + g->ob_callback_arg = NULL; + Py_XDECREF(tmp); + } PyList_SetItem(allgenerics, i, (PyObject *)NULL); nfreeslots++; } diff -r 06772ba3d001 Modules/itertoolsmodule.c --- a/Modules/itertoolsmodule.c Thu Oct 04 22:52:07 2012 +0300 +++ b/Modules/itertoolsmodule.c Fri Nov 09 02:14:14 2012 +0100 @@ -475,8 +475,11 @@ tee_next(teeobject *to) if (to->index >= LINKCELLS) { link = teedataobject_jumplink(to->dataobj); - Py_DECREF(to->dataobj); - to->dataobj = (teedataobject *)link; + { + PyObject *tmp = to->dataobj; + to->dataobj = (teedataobject *)link; + Py_DECREF(tmp); + } to->index = 0; } value = teedataobject_getitem(to->dataobj, to->index); diff -r 06772ba3d001 Modules/selectmodule.c --- a/Modules/selectmodule.c Thu Oct 04 22:52:07 2012 +0300 +++ b/Modules/selectmodule.c Fri Nov 09 02:14:14 2012 +0100 @@ -71,8 +71,11 @@ reap_obj(pylist fd2obj[FD_SETSIZE + 1]) { int i; for (i = 0; i < FD_SETSIZE + 1 && fd2obj[i].sentinel >= 0; i++) { - Py_XDECREF(fd2obj[i].obj); - fd2obj[i].obj = NULL; + { + PyObject *tmp = fd2obj->obj; + fd2obj->obj = NULL; + Py_XDECREF(tmp); + } } fd2obj[0].sentinel = -1; } diff -r 06772ba3d001 Modules/signalmodule.c --- a/Modules/signalmodule.c Thu Oct 04 22:52:07 2012 +0300 +++ b/Modules/signalmodule.c Fri Nov 09 02:14:14 2012 +0100 @@ -613,8 +613,11 @@ initsignal(void) if (Handlers[SIGINT].func == DefaultHandler) { /* Install default int handler */ Py_INCREF(IntHandler); - Py_DECREF(Handlers[SIGINT].func); - Handlers[SIGINT].func = IntHandler; + { + PyObject *tmp = Handlers->func; + Handlers->func = IntHandler; + Py_DECREF(tmp); + } old_siginthandler = PyOS_setsig(SIGINT, signal_handler); } diff -r 06772ba3d001 Modules/svmodule.c --- a/Modules/svmodule.c Thu Oct 04 22:52:07 2012 +0300 +++ b/Modules/svmodule.c Fri Nov 09 02:14:14 2012 +0100 @@ -279,8 +279,11 @@ capture_dealloc(captureobject *self) (void)svUnlockCaptureData(self->ob_svideo->ob_svideo, self->ob_capture); self->ob_capture = NULL; - Py_DECREF(self->ob_svideo); - self->ob_svideo = NULL; + { + PyObject *tmp = self->ob_svideo; + self->ob_svideo = NULL; + Py_DECREF(tmp); + } } PyObject_Del(self); } diff -r 06772ba3d001 Modules/zlibmodule.c --- a/Modules/zlibmodule.c Thu Oct 04 22:52:07 2012 +0300 +++ b/Modules/zlibmodule.c Fri Nov 09 02:14:14 2012 +0100 @@ -544,14 +544,19 @@ PyZlib_objdecompress(compobject *self, P if(max_length) { /* Not all of the compressed data could be accommodated in a buffer of the specified size. Return the unconsumed tail in an attribute. */ - Py_DECREF(self->unconsumed_tail); - self->unconsumed_tail = PyString_FromStringAndSize((char *)self->zst.next_in, - self->zst.avail_in); + { + PyObject *tmp = self->unconsumed_tail; + self->unconsumed_tail = PyString_FromStringAndSize((char *)self->zst.next_in, self->zst.avail_in); + Py_DECREF(tmp); + } } else if (PyString_GET_SIZE(self->unconsumed_tail) > 0) { /* All of the compressed data was consumed. Clear unconsumed_tail. */ - Py_DECREF(self->unconsumed_tail); - self->unconsumed_tail = PyString_FromStringAndSize("", 0); + { + PyObject *tmp = self->unconsumed_tail; + self->unconsumed_tail = PyString_FromStringAndSize("", 0); + Py_DECREF(tmp); + } } if(!self->unconsumed_tail) { Py_DECREF(RetVal); @@ -566,9 +571,11 @@ PyZlib_objdecompress(compobject *self, P preserved. */ if (err == Z_STREAM_END) { - Py_XDECREF(self->unused_data); /* Free original empty string */ - self->unused_data = PyString_FromStringAndSize( - (char *)self->zst.next_in, self->zst.avail_in); + { + PyObject *tmp = self->unused_data; + self->unused_data = PyString_FromStringAndSize((char *)self->zst.next_in, self->zst.avail_in); + Py_XDECREF(tmp); + } if (self->unused_data == NULL) { Py_DECREF(RetVal); goto error; diff -r 06772ba3d001 Objects/descrobject.c --- a/Objects/descrobject.c Thu Oct 04 22:52:07 2012 +0300 +++ b/Objects/descrobject.c Fri Nov 09 02:14:14 2012 +0100 @@ -1332,8 +1332,11 @@ property_init(PyObject *self, PyObject * PyObject *get_doc = PyObject_GetAttrString(get, "__doc__"); if (get_doc) { if (Py_TYPE(self) == &PyProperty_Type) { - Py_XDECREF(prop->prop_doc); - prop->prop_doc = get_doc; + { + PyObject *tmp = prop->prop_doc; + prop->prop_doc = get_doc; + Py_XDECREF(tmp); + } } else { /* If this is a property subclass, put __doc__ diff -r 06772ba3d001 Objects/exceptions.c --- a/Objects/exceptions.c Thu Oct 04 22:52:07 2012 +0300 +++ b/Objects/exceptions.c Fri Nov 09 02:14:14 2012 +0100 @@ -58,8 +58,11 @@ BaseException_init(PyBaseExceptionObject if (!_PyArg_NoKeywords(Py_TYPE(self)->tp_name, kwds)) return -1; - Py_DECREF(self->args); - self->args = args; + { + PyObject *tmp = self->args; + self->args = args; + Py_DECREF(tmp); + } Py_INCREF(self->args); if (PyTuple_GET_SIZE(self->args) == 1) { @@ -349,8 +352,11 @@ BaseException_set_message(PyBaseExceptio if (PyDict_DelItemString(self->dict, "message") < 0) return -1; } - Py_XDECREF(self->message); - self->message = NULL; + { + PyObject *tmp = self->message; + self->message = NULL; + Py_XDECREF(tmp); + } return 0; } @@ -628,8 +634,11 @@ EnvironmentError_init(PyEnvironmentError if (!subslice) return -1; - Py_DECREF(self->args); /* replacing args */ - self->args = subslice; + { + PyObject *tmp = self->args; + self->args = subslice; + Py_DECREF(tmp); + } } return 0; } diff -r 06772ba3d001 Objects/fileobject.c --- a/Objects/fileobject.c Thu Oct 04 22:52:07 2012 +0300 +++ b/Objects/fileobject.c Fri Nov 09 02:14:14 2012 +0100 @@ -574,10 +574,16 @@ PyFile_SetEncodingAndErrors(PyObject *f, oerrors = Py_None; Py_INCREF(Py_None); } - Py_DECREF(file->f_encoding); - file->f_encoding = str; - Py_DECREF(file->f_errors); - file->f_errors = oerrors; + { + PyObject *tmp = file->f_encoding; + file->f_encoding = str; + Py_DECREF(tmp); + } + { + PyObject *tmp = file->f_errors; + file->f_errors = oerrors; + Py_DECREF(tmp); + } return 1; } diff -r 06772ba3d001 Objects/funcobject.c --- a/Objects/funcobject.c Thu Oct 04 22:52:07 2012 +0300 +++ b/Objects/funcobject.c Fri Nov 09 02:14:14 2012 +0100 @@ -430,8 +430,11 @@ func_new(PyTypeObject* type, PyObject* a if (name != Py_None) { Py_INCREF(name); - Py_DECREF(newfunc->func_name); - newfunc->func_name = name; + { + PyObject *tmp = newfunc->func_name; + newfunc->func_name = name; + Py_DECREF(tmp); + } } if (defaults != Py_None) { Py_INCREF(defaults); diff -r 06772ba3d001 Objects/typeobject.c --- a/Objects/typeobject.c Thu Oct 04 22:52:07 2012 +0300 +++ b/Objects/typeobject.c Fri Nov 09 02:14:14 2012 +0100 @@ -166,8 +166,11 @@ assign_version_tag(PyTypeObject *type) are borrowed reference */ for (i = 0; i < (1 << MCACHE_SIZE_EXP); i++) { method_cache[i].value = NULL; - Py_XDECREF(method_cache[i].name); - method_cache[i].name = Py_None; + { + PyObject *tmp = method_cache->name; + method_cache->name = Py_None; + Py_XDECREF(tmp); + } Py_INCREF(Py_None); } /* mark all version tags as invalid */ @@ -253,8 +256,11 @@ type_set_name(PyTypeObject *type, PyObje Py_INCREF(value); - Py_DECREF(et->ht_name); - et->ht_name = value; + { + PyObject *tmp = et->ht_name; + et->ht_name = value; + Py_DECREF(tmp); + } type->tp_name = PyString_AS_STRING(value); @@ -2524,8 +2530,11 @@ PyObject * method_cache[h].version = type->tp_version_tag; method_cache[h].value = res; /* borrowed */ Py_INCREF(name); - Py_DECREF(method_cache[h].name); - method_cache[h].name = name; + { + PyObject *tmp = method_cache->name; + method_cache->name = name; + Py_DECREF(tmp); + } } return res; } diff -r 06772ba3d001 Python/ceval.c --- a/Python/ceval.c Thu Oct 04 22:52:07 2012 +0300 +++ b/Python/ceval.c Fri Nov 09 02:14:14 2012 +0100 @@ -3240,8 +3240,11 @@ PyEval_EvalCodeEx(PyCodeObject *co, PyOb if (co->co_flags & CO_GENERATOR) { /* Don't need to keep the reference to f_back, it will be set * when the generator is resumed. */ - Py_XDECREF(f->f_back); - f->f_back = NULL; + { + PyObject *tmp = f->f_back; + f->f_back = NULL; + Py_XDECREF(tmp); + } PCALL(PCALL_GENERATOR); diff -r 06772ba3d001 Python/sysmodule.c --- a/Python/sysmodule.c Thu Oct 04 22:52:07 2012 +0300 +++ b/Python/sysmodule.c Fri Nov 09 02:14:14 2012 +0100 @@ -367,8 +367,11 @@ trace_trampoline(PyObject *self, PyFrame result = call_trampoline(tstate, callback, frame, what, arg); if (result == NULL) { PyEval_SetTrace(NULL, NULL); - Py_XDECREF(frame->f_trace); - frame->f_trace = NULL; + { + PyObject *tmp = frame->f_trace; + frame->f_trace = NULL; + Py_XDECREF(tmp); + } return -1; } if (result != Py_None) {