Kaydet (Commit) fe21de98 authored tarafından Berker Peksag's avatar Berker Peksag

Issue #26687: Use Py_RETURN_NONE macro in sqlite3 module

üst 8278d13f
...@@ -244,8 +244,7 @@ PyObject* pysqlite_cache_display(pysqlite_Cache* self, PyObject* args) ...@@ -244,8 +244,7 @@ PyObject* pysqlite_cache_display(pysqlite_Cache* self, PyObject* args)
ptr = ptr->next; ptr = ptr->next;
} }
Py_INCREF(Py_None); Py_RETURN_NONE;
return Py_None;
} }
static PyMethodDef cache_methods[] = { static PyMethodDef cache_methods[] = {
......
...@@ -348,8 +348,7 @@ PyObject* pysqlite_connection_close(pysqlite_Connection* self, PyObject* args) ...@@ -348,8 +348,7 @@ PyObject* pysqlite_connection_close(pysqlite_Connection* self, PyObject* args)
} }
} }
Py_INCREF(Py_None); Py_RETURN_NONE;
return Py_None;
} }
/* /*
...@@ -857,8 +856,7 @@ PyObject* pysqlite_connection_create_function(pysqlite_Connection* self, PyObjec ...@@ -857,8 +856,7 @@ PyObject* pysqlite_connection_create_function(pysqlite_Connection* self, PyObjec
if (PyDict_SetItem(self->function_pinboard, func, Py_None) == -1) if (PyDict_SetItem(self->function_pinboard, func, Py_None) == -1)
return NULL; return NULL;
Py_INCREF(Py_None); Py_RETURN_NONE;
return Py_None;
} }
} }
...@@ -889,8 +887,7 @@ PyObject* pysqlite_connection_create_aggregate(pysqlite_Connection* self, PyObje ...@@ -889,8 +887,7 @@ PyObject* pysqlite_connection_create_aggregate(pysqlite_Connection* self, PyObje
if (PyDict_SetItem(self->function_pinboard, aggregate_class, Py_None) == -1) if (PyDict_SetItem(self->function_pinboard, aggregate_class, Py_None) == -1)
return NULL; return NULL;
Py_INCREF(Py_None); Py_RETURN_NONE;
return Py_None;
} }
} }
...@@ -1025,8 +1022,7 @@ static PyObject* pysqlite_connection_set_authorizer(pysqlite_Connection* self, P ...@@ -1025,8 +1022,7 @@ static PyObject* pysqlite_connection_set_authorizer(pysqlite_Connection* self, P
if (PyDict_SetItem(self->function_pinboard, authorizer_cb, Py_None) == -1) if (PyDict_SetItem(self->function_pinboard, authorizer_cb, Py_None) == -1)
return NULL; return NULL;
Py_INCREF(Py_None); Py_RETURN_NONE;
return Py_None;
} }
} }
...@@ -1055,8 +1051,7 @@ static PyObject* pysqlite_connection_set_progress_handler(pysqlite_Connection* s ...@@ -1055,8 +1051,7 @@ static PyObject* pysqlite_connection_set_progress_handler(pysqlite_Connection* s
return NULL; return NULL;
} }
Py_INCREF(Py_None); Py_RETURN_NONE;
return Py_None;
} }
static PyObject* pysqlite_connection_set_trace_callback(pysqlite_Connection* self, PyObject* args, PyObject* kwargs) static PyObject* pysqlite_connection_set_trace_callback(pysqlite_Connection* self, PyObject* args, PyObject* kwargs)
...@@ -1083,8 +1078,7 @@ static PyObject* pysqlite_connection_set_trace_callback(pysqlite_Connection* sel ...@@ -1083,8 +1078,7 @@ static PyObject* pysqlite_connection_set_trace_callback(pysqlite_Connection* sel
sqlite3_trace(self->db, _trace_callback, trace_callback); sqlite3_trace(self->db, _trace_callback, trace_callback);
} }
Py_INCREF(Py_None); Py_RETURN_NONE;
return Py_None;
} }
#ifdef HAVE_LOAD_EXTENSION #ifdef HAVE_LOAD_EXTENSION
...@@ -1107,8 +1101,7 @@ static PyObject* pysqlite_enable_load_extension(pysqlite_Connection* self, PyObj ...@@ -1107,8 +1101,7 @@ static PyObject* pysqlite_enable_load_extension(pysqlite_Connection* self, PyObj
PyErr_SetString(pysqlite_OperationalError, "Error enabling load extension"); PyErr_SetString(pysqlite_OperationalError, "Error enabling load extension");
return NULL; return NULL;
} else { } else {
Py_INCREF(Py_None); Py_RETURN_NONE;
return Py_None;
} }
} }
...@@ -1131,8 +1124,7 @@ static PyObject* pysqlite_load_extension(pysqlite_Connection* self, PyObject* ar ...@@ -1131,8 +1124,7 @@ static PyObject* pysqlite_load_extension(pysqlite_Connection* self, PyObject* ar
PyErr_SetString(pysqlite_OperationalError, errmsg); PyErr_SetString(pysqlite_OperationalError, errmsg);
return NULL; return NULL;
} else { } else {
Py_INCREF(Py_None); Py_RETURN_NONE;
return Py_None;
} }
} }
#endif #endif
......
...@@ -242,8 +242,7 @@ PyObject* _pysqlite_build_column_name(const char* colname) ...@@ -242,8 +242,7 @@ PyObject* _pysqlite_build_column_name(const char* colname)
const char* pos; const char* pos;
if (!colname) { if (!colname) {
Py_INCREF(Py_None); Py_RETURN_NONE;
return Py_None;
} }
for (pos = colname;; pos++) { for (pos = colname;; pos++) {
...@@ -914,8 +913,7 @@ PyObject* pysqlite_cursor_fetchone(pysqlite_Cursor* self, PyObject* args) ...@@ -914,8 +913,7 @@ PyObject* pysqlite_cursor_fetchone(pysqlite_Cursor* self, PyObject* args)
row = pysqlite_cursor_iternext(self); row = pysqlite_cursor_iternext(self);
if (!row && !PyErr_Occurred()) { if (!row && !PyErr_Occurred()) {
Py_INCREF(Py_None); Py_RETURN_NONE;
return Py_None;
} }
return row; return row;
...@@ -996,8 +994,7 @@ PyObject* pysqlite_cursor_fetchall(pysqlite_Cursor* self, PyObject* args) ...@@ -996,8 +994,7 @@ PyObject* pysqlite_cursor_fetchall(pysqlite_Cursor* self, PyObject* args)
PyObject* pysqlite_noop(pysqlite_Connection* self, PyObject* args) PyObject* pysqlite_noop(pysqlite_Connection* self, PyObject* args)
{ {
/* don't care, return None */ /* don't care, return None */
Py_INCREF(Py_None); Py_RETURN_NONE;
return Py_None;
} }
PyObject* pysqlite_cursor_close(pysqlite_Cursor* self, PyObject* args) PyObject* pysqlite_cursor_close(pysqlite_Cursor* self, PyObject* args)
...@@ -1013,8 +1010,7 @@ PyObject* pysqlite_cursor_close(pysqlite_Cursor* self, PyObject* args) ...@@ -1013,8 +1010,7 @@ PyObject* pysqlite_cursor_close(pysqlite_Cursor* self, PyObject* args)
self->closed = 1; self->closed = 1;
Py_INCREF(Py_None); Py_RETURN_NONE;
return Py_None;
} }
static PyMethodDef cursor_methods[] = { static PyMethodDef cursor_methods[] = {
......
...@@ -139,8 +139,7 @@ static PyObject* module_enable_shared_cache(PyObject* self, PyObject* args, PyOb ...@@ -139,8 +139,7 @@ static PyObject* module_enable_shared_cache(PyObject* self, PyObject* args, PyOb
PyErr_SetString(pysqlite_OperationalError, "Changing the shared_cache flag failed"); PyErr_SetString(pysqlite_OperationalError, "Changing the shared_cache flag failed");
return NULL; return NULL;
} else { } else {
Py_INCREF(Py_None); Py_RETURN_NONE;
return Py_None;
} }
} }
...@@ -172,8 +171,7 @@ static PyObject* module_register_adapter(PyObject* self, PyObject* args) ...@@ -172,8 +171,7 @@ static PyObject* module_register_adapter(PyObject* self, PyObject* args)
if (rc == -1) if (rc == -1)
return NULL; return NULL;
Py_INCREF(Py_None); Py_RETURN_NONE;
return Py_None;
} }
PyDoc_STRVAR(module_register_adapter_doc, PyDoc_STRVAR(module_register_adapter_doc,
...@@ -221,8 +219,7 @@ static PyObject* enable_callback_tracebacks(PyObject* self, PyObject* args) ...@@ -221,8 +219,7 @@ static PyObject* enable_callback_tracebacks(PyObject* self, PyObject* args)
return NULL; return NULL;
} }
Py_INCREF(Py_None); Py_RETURN_NONE;
return Py_None;
} }
PyDoc_STRVAR(enable_callback_tracebacks_doc, PyDoc_STRVAR(enable_callback_tracebacks_doc,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment