summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorErlend Egeberg Aasland <erlend.aasland@innova.no>2021-02-21 00:29:19 (GMT)
committerGitHub <noreply@github.com>2021-02-21 00:29:19 (GMT)
commitbf838a6e7eec2063a17c7c33dfa94afeef116f36 (patch)
tree4a2354282efb10753e55d977edf34e56e07de428 /Modules
parentd439fb304ca3098aab1ed0a314996f9d29347b21 (diff)
downloadcpython-bf838a6e7eec2063a17c7c33dfa94afeef116f36.zip
cpython-bf838a6e7eec2063a17c7c33dfa94afeef116f36.tar.gz
cpython-bf838a6e7eec2063a17c7c33dfa94afeef116f36.tar.bz2
bpo-43269: Clean up sqlite3 file scope (GH-24578)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_sqlite/cache.c15
-rw-r--r--Modules/_sqlite/connection.c20
-rw-r--r--Modules/_sqlite/cursor.c5
-rw-r--r--Modules/_sqlite/prepare_protocol.c7
-rw-r--r--Modules/_sqlite/row.c6
-rw-r--r--Modules/_sqlite/statement.c3
6 files changed, 37 insertions, 19 deletions
diff --git a/Modules/_sqlite/cache.c b/Modules/_sqlite/cache.c
index 078a484..ec4a22f 100644
--- a/Modules/_sqlite/cache.c
+++ b/Modules/_sqlite/cache.c
@@ -25,7 +25,8 @@
#include <limits.h>
/* only used internally */
-pysqlite_Node* pysqlite_new_node(PyObject* key, PyObject* data)
+static pysqlite_Node *
+pysqlite_new_node(PyObject *key, PyObject *data)
{
pysqlite_Node* node;
@@ -43,7 +44,8 @@ pysqlite_Node* pysqlite_new_node(PyObject* key, PyObject* data)
return node;
}
-void pysqlite_node_dealloc(pysqlite_Node* self)
+static void
+pysqlite_node_dealloc(pysqlite_Node *self)
{
PyTypeObject *tp = Py_TYPE(self);
@@ -54,7 +56,8 @@ void pysqlite_node_dealloc(pysqlite_Node* self)
Py_DECREF(tp);
}
-int pysqlite_cache_init(pysqlite_Cache* self, PyObject* args, PyObject* kwargs)
+static int
+pysqlite_cache_init(pysqlite_Cache *self, PyObject *args, PyObject *kwargs)
{
PyObject* factory;
int size = 10;
@@ -85,7 +88,8 @@ int pysqlite_cache_init(pysqlite_Cache* self, PyObject* args, PyObject* kwargs)
return 0;
}
-void pysqlite_cache_dealloc(pysqlite_Cache* self)
+static void
+pysqlite_cache_dealloc(pysqlite_Cache *self)
{
PyTypeObject *tp = Py_TYPE(self);
pysqlite_Node* node;
@@ -217,7 +221,8 @@ PyObject* pysqlite_cache_get(pysqlite_Cache* self, PyObject* key)
return Py_NewRef(node->data);
}
-PyObject* pysqlite_cache_display(pysqlite_Cache* self, PyObject* args)
+static PyObject *
+pysqlite_cache_display(pysqlite_Cache *self, PyObject *args)
{
pysqlite_Node* ptr;
PyObject* prevkey;
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
index 81f12e8..34ba29b 100644
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -57,8 +57,9 @@ static const char * const begin_statements[] = {
static int pysqlite_connection_set_isolation_level(pysqlite_Connection* self, PyObject* isolation_level, void *Py_UNUSED(ignored));
static void _pysqlite_drop_unused_cursor_references(pysqlite_Connection* self);
-
-int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject* kwargs)
+static int
+pysqlite_connection_init(pysqlite_Connection *self, PyObject *args,
+ PyObject *kwargs)
{
static char *kwlist[] = {
"database", "timeout", "detect_types", "isolation_level",
@@ -193,7 +194,9 @@ int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject
}
/* action in (ACTION_RESET, ACTION_FINALIZE) */
-void pysqlite_do_all_statements(pysqlite_Connection* self, int action, int reset_cursors)
+static void
+pysqlite_do_all_statements(pysqlite_Connection *self, int action,
+ int reset_cursors)
{
int i;
PyObject* weakref;
@@ -225,7 +228,8 @@ void pysqlite_do_all_statements(pysqlite_Connection* self, int action, int reset
}
}
-void pysqlite_connection_dealloc(pysqlite_Connection* self)
+static void
+pysqlite_connection_dealloc(pysqlite_Connection *self)
{
PyTypeObject *tp = Py_TYPE(self);
@@ -546,7 +550,9 @@ _pysqlite_set_result(sqlite3_context* context, PyObject* py_val)
return 0;
}
-PyObject* _pysqlite_build_py_params(sqlite3_context *context, int argc, sqlite3_value** argv)
+static PyObject *
+_pysqlite_build_py_params(sqlite3_context *context, int argc,
+ sqlite3_value **argv)
{
PyObject* args;
int i;
@@ -1288,7 +1294,9 @@ pysqlite_connection_set_isolation_level(pysqlite_Connection* self, PyObject* iso
return 0;
}
-PyObject* pysqlite_connection_call(pysqlite_Connection* self, PyObject* args, PyObject* kwargs)
+static PyObject *
+pysqlite_connection_call(pysqlite_Connection *self, PyObject *args,
+ PyObject *kwargs)
{
PyObject* sql;
pysqlite_Statement* statement;
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c
index d1578ad..9058aab 100644
--- a/Modules/_sqlite/cursor.c
+++ b/Modules/_sqlite/cursor.c
@@ -32,8 +32,6 @@ class _sqlite3.Cursor "pysqlite_Cursor *" "pysqlite_CursorType"
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=b2072d8db95411d5]*/
-PyObject* pysqlite_cursor_iternext(pysqlite_Cursor* self);
-
static const char errmsg_fetch_across_rollback[] = "Cursor needed to be reset because of commit/rollback and can no longer be fetched from.";
/*[clinic input]
@@ -746,7 +744,8 @@ error:
}
}
-PyObject* pysqlite_cursor_iternext(pysqlite_Cursor *self)
+static PyObject *
+pysqlite_cursor_iternext(pysqlite_Cursor *self)
{
PyObject* next_row_tuple;
PyObject* next_row;
diff --git a/Modules/_sqlite/prepare_protocol.c b/Modules/_sqlite/prepare_protocol.c
index 089d66b..ad79332 100644
--- a/Modules/_sqlite/prepare_protocol.c
+++ b/Modules/_sqlite/prepare_protocol.c
@@ -23,12 +23,15 @@
#include "prepare_protocol.h"
-int pysqlite_prepare_protocol_init(pysqlite_PrepareProtocol* self, PyObject* args, PyObject* kwargs)
+static int
+pysqlite_prepare_protocol_init(pysqlite_PrepareProtocol *self, PyObject *args,
+ PyObject *kwargs)
{
return 0;
}
-void pysqlite_prepare_protocol_dealloc(pysqlite_PrepareProtocol* self)
+static void
+pysqlite_prepare_protocol_dealloc(pysqlite_PrepareProtocol *self)
{
PyTypeObject *tp = Py_TYPE(self);
diff --git a/Modules/_sqlite/row.c b/Modules/_sqlite/row.c
index 04e308f..97a5a17 100644
--- a/Modules/_sqlite/row.c
+++ b/Modules/_sqlite/row.c
@@ -31,7 +31,8 @@ class _sqlite3.Row "pysqlite_Row *" "pysqlite_RowType"
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=384227da65f250fd]*/
-void pysqlite_row_dealloc(pysqlite_Row* self)
+static void
+pysqlite_row_dealloc(pysqlite_Row *self)
{
PyTypeObject *tp = Py_TYPE(self);
@@ -105,7 +106,8 @@ equal_ignore_case(PyObject *left, PyObject *right)
return 1;
}
-PyObject* pysqlite_row_subscript(pysqlite_Row* self, PyObject* idx)
+static PyObject *
+pysqlite_row_subscript(pysqlite_Row *self, PyObject *idx)
{
Py_ssize_t _idx;
Py_ssize_t nitems, i;
diff --git a/Modules/_sqlite/statement.c b/Modules/_sqlite/statement.c
index b62de58..f179eee 100644
--- a/Modules/_sqlite/statement.c
+++ b/Modules/_sqlite/statement.c
@@ -368,7 +368,8 @@ void pysqlite_statement_mark_dirty(pysqlite_Statement* self)
self->in_use = 1;
}
-void pysqlite_statement_dealloc(pysqlite_Statement* self)
+static void
+pysqlite_statement_dealloc(pysqlite_Statement *self)
{
PyTypeObject *tp = Py_TYPE(self);