From 5d858465b6ebdafa05f86309457848cc26913b6a Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sun, 20 Nov 2016 10:16:47 +0200 Subject: Added the const qualifier to char* variables that refer to readonly internal UTF-8 represenatation of Unicode objects. --- Modules/_sqlite/connection.c | 2 +- Modules/_sqlite/row.c | 8 ++++---- Modules/_sqlite/statement.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'Modules/_sqlite') diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index 1c6aa54c22..4cd3cb3e05 100644 --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -1489,7 +1489,7 @@ pysqlite_connection_create_collation(pysqlite_Connection* self, PyObject* args) PyObject* retval; Py_ssize_t i, len; _Py_IDENTIFIER(upper); - char *uppercase_name_str; + const char *uppercase_name_str; int rc; unsigned int kind; void *data; diff --git a/Modules/_sqlite/row.c b/Modules/_sqlite/row.c index 53342f3444..c6c3e98bb2 100644 --- a/Modules/_sqlite/row.c +++ b/Modules/_sqlite/row.c @@ -79,12 +79,12 @@ PyObject* pysqlite_row_item(pysqlite_Row* self, Py_ssize_t idx) PyObject* pysqlite_row_subscript(pysqlite_Row* self, PyObject* idx) { Py_ssize_t _idx; - char* key; + const char *key; Py_ssize_t nitems, i; - char* compare_key; + const char *compare_key; - char* p1; - char* p2; + const char *p1; + const char *p2; PyObject* item; diff --git a/Modules/_sqlite/statement.c b/Modules/_sqlite/statement.c index 0df661b9c7..8b45a03320 100644 --- a/Modules/_sqlite/statement.c +++ b/Modules/_sqlite/statement.c @@ -112,7 +112,7 @@ int pysqlite_statement_create(pysqlite_Statement* self, pysqlite_Connection* con int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObject* parameter) { int rc = SQLITE_OK; - char* string; + const char *string; Py_ssize_t buflen; parameter_type paramtype; -- cgit v1.2.1 From 6974284a5631861776f49b2cd8c84aeb76b78e8c Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 9 Dec 2016 12:29:18 +0100 Subject: Issue #28915: Use _PyObject_CallNoArg() Replace PyObject_CallFunction(func, NULL) with _PyObject_CallNoArg(func). --- Modules/_sqlite/connection.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Modules/_sqlite') diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index 4cd3cb3e05..7bbc15c021 100644 --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -645,7 +645,7 @@ static void _pysqlite_step_callback(sqlite3_context *context, int argc, sqlite3_ aggregate_instance = (PyObject**)sqlite3_aggregate_context(context, sizeof(PyObject*)); if (*aggregate_instance == 0) { - *aggregate_instance = PyObject_CallFunction(aggregate_class, NULL); + *aggregate_instance = _PyObject_CallNoArg(aggregate_class); if (PyErr_Occurred()) { *aggregate_instance = 0; @@ -933,7 +933,7 @@ static int _progress_handler(void* user_arg) gilstate = PyGILState_Ensure(); #endif - ret = PyObject_CallFunction((PyObject*)user_arg, NULL); + ret = _PyObject_CallNoArg((PyObject*)user_arg); if (!ret) { if (_enable_callback_tracebacks) { -- cgit v1.2.1 From f22b56b777f7134b5c4e6c9caa9249e92c4f4fd9 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Fri, 16 Dec 2016 16:18:57 +0200 Subject: Issue #28959: Added private macro PyDict_GET_SIZE for retrieving the size of dict. --- Modules/_sqlite/cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Modules/_sqlite') diff --git a/Modules/_sqlite/cache.c b/Modules/_sqlite/cache.c index 62c58931fa..72b1f2c561 100644 --- a/Modules/_sqlite/cache.c +++ b/Modules/_sqlite/cache.c @@ -162,7 +162,7 @@ PyObject* pysqlite_cache_get(pysqlite_Cache* self, PyObject* args) * entry in the cache, and make space if necessary by throwing the * least used item out of the cache. */ - if (PyDict_Size(self->mapping) == self->size) { + if (PyDict_GET_SIZE(self->mapping) == self->size) { if (self->last) { node = self->last; -- cgit v1.2.1 From 063159b7f20bc4a44fe64978638d4d03fc4f980b Mon Sep 17 00:00:00 2001 From: Berker Peksag Date: Mon, 2 Jan 2017 06:38:10 +0300 Subject: Issue #28985: Update authorizer constants in sqlite3 module Dates and version information from the changelog: * 2006-08-12 (3.3.7) added SQLITE_CREATE_VTABLE, SQLITE_DROP_VTABLE * 2006-10-09 (3.3.8) added SQLITE_FUNCTION * 2009-01-12 (3.6.8) added SQLITE_SAVEPOINT * 2014-02-03 (3.8.3) added SQLITE_RECURSIVE Patch by Dingyuan Wang. --- Modules/_sqlite/module.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Modules/_sqlite') diff --git a/Modules/_sqlite/module.c b/Modules/_sqlite/module.c index cc45331ab5..72c3a7f34f 100644 --- a/Modules/_sqlite/module.c +++ b/Modules/_sqlite/module.c @@ -302,6 +302,19 @@ static const IntConstantPair _int_constants[] = { #endif #if SQLITE_VERSION_NUMBER >= 3003000 {"SQLITE_ANALYZE", SQLITE_ANALYZE}, +#endif +#if SQLITE_VERSION_NUMBER >= 3003007 + {"SQLITE_CREATE_VTABLE", SQLITE_CREATE_VTABLE}, + {"SQLITE_DROP_VTABLE", SQLITE_DROP_VTABLE}, +#endif +#if SQLITE_VERSION_NUMBER >= 3003008 + {"SQLITE_FUNCTION", SQLITE_FUNCTION}, +#endif +#if SQLITE_VERSION_NUMBER >= 3006008 + {"SQLITE_SAVEPOINT", SQLITE_SAVEPOINT}, +#endif +#if SQLITE_VERSION_NUMBER >= 3008003 + {"SQLITE_RECURSIVE", SQLITE_RECURSIVE}, #endif {(char*)NULL, 0} }; -- cgit v1.2.1 From bfeec6d871e3db2e0ddfdef01387913bc19cadd4 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Mon, 23 Jan 2017 09:47:21 +0200 Subject: Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever possible. Patch is writen with Coccinelle. --- Modules/_sqlite/connection.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'Modules/_sqlite') diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index 7bbc15c021..37b45f330b 100644 --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -400,8 +400,7 @@ error: if (PyErr_Occurred()) { return NULL; } else { - Py_INCREF(Py_None); - return Py_None; + Py_RETURN_NONE; } } @@ -443,8 +442,7 @@ error: if (PyErr_Occurred()) { return NULL; } else { - Py_INCREF(Py_None); - return Py_None; + Py_RETURN_NONE; } } @@ -487,8 +485,7 @@ error: if (PyErr_Occurred()) { return NULL; } else { - Py_INCREF(Py_None); - return Py_None; + Py_RETURN_NONE; } } -- cgit v1.2.1