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