aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Modules/_sqlite
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.ru>2022-02-10 16:44:30 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:30 +0300
commit2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch)
tree012bb94d777798f1f56ac1cec429509766d05181 /contrib/tools/python3/src/Modules/_sqlite
parent6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff)
downloadydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/tools/python3/src/Modules/_sqlite')
-rw-r--r--contrib/tools/python3/src/Modules/_sqlite/cache.c28
-rw-r--r--contrib/tools/python3/src/Modules/_sqlite/cache.h2
-rw-r--r--contrib/tools/python3/src/Modules/_sqlite/connection.c402
-rw-r--r--contrib/tools/python3/src/Modules/_sqlite/connection.h10
-rw-r--r--contrib/tools/python3/src/Modules/_sqlite/cursor.c200
-rw-r--r--contrib/tools/python3/src/Modules/_sqlite/cursor.h2
-rw-r--r--contrib/tools/python3/src/Modules/_sqlite/microprotocols.c92
-rw-r--r--contrib/tools/python3/src/Modules/_sqlite/microprotocols.h2
-rw-r--r--contrib/tools/python3/src/Modules/_sqlite/module.c38
-rw-r--r--contrib/tools/python3/src/Modules/_sqlite/module.h2
-rw-r--r--contrib/tools/python3/src/Modules/_sqlite/prepare_protocol.c6
-rw-r--r--contrib/tools/python3/src/Modules/_sqlite/prepare_protocol.h2
-rw-r--r--contrib/tools/python3/src/Modules/_sqlite/row.c82
-rw-r--r--contrib/tools/python3/src/Modules/_sqlite/row.h2
-rw-r--r--contrib/tools/python3/src/Modules/_sqlite/statement.c56
-rw-r--r--contrib/tools/python3/src/Modules/_sqlite/statement.h2
-rw-r--r--contrib/tools/python3/src/Modules/_sqlite/util.h2
-rw-r--r--contrib/tools/python3/src/Modules/_sqlite/ya.make8
18 files changed, 469 insertions, 469 deletions
diff --git a/contrib/tools/python3/src/Modules/_sqlite/cache.c b/contrib/tools/python3/src/Modules/_sqlite/cache.c
index 758fc022f7..127a2bc812 100644
--- a/contrib/tools/python3/src/Modules/_sqlite/cache.c
+++ b/contrib/tools/python3/src/Modules/_sqlite/cache.c
@@ -112,13 +112,13 @@ void pysqlite_cache_dealloc(pysqlite_Cache* self)
Py_TYPE(self)->tp_free((PyObject*)self);
}
-PyObject* pysqlite_cache_get(pysqlite_Cache* self, PyObject* key)
+PyObject* pysqlite_cache_get(pysqlite_Cache* self, PyObject* key)
{
pysqlite_Node* node;
pysqlite_Node* ptr;
PyObject* data;
- node = (pysqlite_Node*)PyDict_GetItemWithError(self->mapping, key);
+ node = (pysqlite_Node*)PyDict_GetItemWithError(self->mapping, key);
if (node) {
/* an entry for this key already exists in the cache */
@@ -156,11 +156,11 @@ PyObject* pysqlite_cache_get(pysqlite_Cache* self, PyObject* key)
}
ptr->prev = node;
}
- }
- else if (PyErr_Occurred()) {
- return NULL;
- }
- else {
+ }
+ else if (PyErr_Occurred()) {
+ return NULL;
+ }
+ else {
/* There is no entry for this key in the cache, yet. We'll insert a new
* entry in the cache, and make space if necessary by throwing the
* least used item out of the cache. */
@@ -183,9 +183,9 @@ PyObject* pysqlite_cache_get(pysqlite_Cache* self, PyObject* key)
}
}
- /* We cannot replace this by PyObject_CallOneArg() since
- * PyObject_CallFunction() has a special case when using a
- * single tuple as argument. */
+ /* We cannot replace this by PyObject_CallOneArg() since
+ * PyObject_CallFunction() has a special case when using a
+ * single tuple as argument. */
data = PyObject_CallFunction(self->factory, "O", key);
if (!data) {
@@ -267,10 +267,10 @@ PyTypeObject pysqlite_NodeType = {
sizeof(pysqlite_Node), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)pysqlite_node_dealloc, /* tp_dealloc */
- 0, /* tp_vectorcall_offset */
+ 0, /* tp_vectorcall_offset */
0, /* tp_getattr */
0, /* tp_setattr */
- 0, /* tp_as_async */
+ 0, /* tp_as_async */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
@@ -309,10 +309,10 @@ PyTypeObject pysqlite_CacheType = {
sizeof(pysqlite_Cache), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)pysqlite_cache_dealloc, /* tp_dealloc */
- 0, /* tp_vectorcall_offset */
+ 0, /* tp_vectorcall_offset */
0, /* tp_getattr */
0, /* tp_setattr */
- 0, /* tp_as_async */
+ 0, /* tp_as_async */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
diff --git a/contrib/tools/python3/src/Modules/_sqlite/cache.h b/contrib/tools/python3/src/Modules/_sqlite/cache.h
index 529010967c..6c3cee3789 100644
--- a/contrib/tools/python3/src/Modules/_sqlite/cache.h
+++ b/contrib/tools/python3/src/Modules/_sqlite/cache.h
@@ -23,7 +23,7 @@
#ifndef PYSQLITE_CACHE_H
#define PYSQLITE_CACHE_H
-#define PY_SSIZE_T_CLEAN
+#define PY_SSIZE_T_CLEAN
#include "Python.h"
/* The LRU cache is implemented as a combination of a doubly-linked with a
diff --git a/contrib/tools/python3/src/Modules/_sqlite/connection.c b/contrib/tools/python3/src/Modules/_sqlite/connection.c
index 30e333a4b8..f3522c1362 100644
--- a/contrib/tools/python3/src/Modules/_sqlite/connection.c
+++ b/contrib/tools/python3/src/Modules/_sqlite/connection.c
@@ -23,7 +23,7 @@
#include "cache.h"
#include "module.h"
-#include "structmember.h" // PyMemberDef
+#include "structmember.h" // PyMemberDef
#include "connection.h"
#include "statement.h"
#include "cursor.h"
@@ -77,7 +77,7 @@ int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject
NULL
};
- const char* database;
+ const char* database;
PyObject* database_obj;
int detect_types = 0;
PyObject* isolation_level = NULL;
@@ -96,11 +96,11 @@ int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject
return -1;
}
- if (PySys_Audit("sqlite3.connect", "O", database_obj) < 0) {
- Py_DECREF(database_obj);
- return -1;
- }
-
+ if (PySys_Audit("sqlite3.connect", "O", database_obj) < 0) {
+ Py_DECREF(database_obj);
+ return -1;
+ }
+
database = PyBytes_AsString(database_obj);
self->begin_statement = NULL;
@@ -134,10 +134,10 @@ int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject
Py_DECREF(database_obj);
- if (self->db == NULL && rc == SQLITE_NOMEM) {
- PyErr_NoMemory();
- return -1;
- }
+ if (self->db == NULL && rc == SQLITE_NOMEM) {
+ PyErr_NoMemory();
+ return -1;
+ }
if (rc != SQLITE_OK) {
_pysqlite_seterror(self->db, NULL);
return -1;
@@ -152,7 +152,7 @@ int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject
Py_INCREF(isolation_level);
}
Py_CLEAR(self->isolation_level);
- if (pysqlite_connection_set_isolation_level(self, isolation_level, NULL) != 0) {
+ if (pysqlite_connection_set_isolation_level(self, isolation_level, NULL) != 0) {
Py_DECREF(isolation_level);
return -1;
}
@@ -191,9 +191,9 @@ int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject
}
self->check_same_thread = check_same_thread;
- self->function_pinboard_trace_callback = NULL;
- self->function_pinboard_progress_handler = NULL;
- self->function_pinboard_authorizer_cb = NULL;
+ self->function_pinboard_trace_callback = NULL;
+ self->function_pinboard_progress_handler = NULL;
+ self->function_pinboard_authorizer_cb = NULL;
Py_XSETREF(self->collations, PyDict_New());
if (!self->collations) {
@@ -211,8 +211,8 @@ int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject
self->ProgrammingError = pysqlite_ProgrammingError;
self->NotSupportedError = pysqlite_NotSupportedError;
- self->initialized = 1;
-
+ self->initialized = 1;
+
return 0;
}
@@ -259,9 +259,9 @@ void pysqlite_connection_dealloc(pysqlite_Connection* self)
}
Py_XDECREF(self->isolation_level);
- Py_XDECREF(self->function_pinboard_trace_callback);
- Py_XDECREF(self->function_pinboard_progress_handler);
- Py_XDECREF(self->function_pinboard_authorizer_cb);
+ Py_XDECREF(self->function_pinboard_trace_callback);
+ Py_XDECREF(self->function_pinboard_progress_handler);
+ Py_XDECREF(self->function_pinboard_authorizer_cb);
Py_XDECREF(self->row_factory);
Py_XDECREF(self->text_factory);
Py_XDECREF(self->collations);
@@ -315,7 +315,7 @@ PyObject* pysqlite_connection_cursor(pysqlite_Connection* self, PyObject* args,
factory = (PyObject*)&pysqlite_CursorType;
}
- cursor = PyObject_CallOneArg(factory, (PyObject *)self);
+ cursor = PyObject_CallOneArg(factory, (PyObject *)self);
if (cursor == NULL)
return NULL;
if (!PyObject_TypeCheck(cursor, &pysqlite_CursorType)) {
@@ -344,12 +344,12 @@ PyObject* pysqlite_connection_close(pysqlite_Connection* self, PyObject* args)
return NULL;
}
- if (!self->initialized) {
- PyErr_SetString(pysqlite_ProgrammingError,
- "Base Connection.__init__ not called.");
- return NULL;
- }
-
+ if (!self->initialized) {
+ PyErr_SetString(pysqlite_ProgrammingError,
+ "Base Connection.__init__ not called.");
+ return NULL;
+ }
+
pysqlite_do_all_statements(self, ACTION_FINALIZE, 1);
if (self->db) {
@@ -520,17 +520,17 @@ _pysqlite_set_result(sqlite3_context* context, PyObject* py_val)
} else if (PyFloat_Check(py_val)) {
sqlite3_result_double(context, PyFloat_AsDouble(py_val));
} else if (PyUnicode_Check(py_val)) {
- Py_ssize_t sz;
- const char *str = PyUnicode_AsUTF8AndSize(py_val, &sz);
- if (str == NULL) {
+ Py_ssize_t sz;
+ const char *str = PyUnicode_AsUTF8AndSize(py_val, &sz);
+ if (str == NULL) {
return -1;
- }
- if (sz > INT_MAX) {
- PyErr_SetString(PyExc_OverflowError,
- "string is longer than INT_MAX bytes");
- return -1;
- }
- sqlite3_result_text(context, str, (int)sz, SQLITE_TRANSIENT);
+ }
+ if (sz > INT_MAX) {
+ PyErr_SetString(PyExc_OverflowError,
+ "string is longer than INT_MAX bytes");
+ return -1;
+ }
+ sqlite3_result_text(context, str, (int)sz, SQLITE_TRANSIENT);
} else if (PyObject_CheckBuffer(py_val)) {
Py_buffer view;
if (PyObject_GetBuffer(py_val, &view, PyBUF_SIMPLE) != 0) {
@@ -569,24 +569,24 @@ PyObject* _pysqlite_build_py_params(sqlite3_context *context, int argc, sqlite3_
cur_value = argv[i];
switch (sqlite3_value_type(argv[i])) {
case SQLITE_INTEGER:
- cur_py_value = PyLong_FromLongLong(sqlite3_value_int64(cur_value));
+ cur_py_value = PyLong_FromLongLong(sqlite3_value_int64(cur_value));
break;
case SQLITE_FLOAT:
cur_py_value = PyFloat_FromDouble(sqlite3_value_double(cur_value));
break;
- case SQLITE_TEXT: {
- sqlite3 *db = sqlite3_context_db_handle(context);
- const char *text = (const char *)sqlite3_value_text(cur_value);
-
- if (text == NULL && sqlite3_errcode(db) == SQLITE_NOMEM) {
- PyErr_NoMemory();
- goto error;
+ case SQLITE_TEXT: {
+ sqlite3 *db = sqlite3_context_db_handle(context);
+ const char *text = (const char *)sqlite3_value_text(cur_value);
+
+ if (text == NULL && sqlite3_errcode(db) == SQLITE_NOMEM) {
+ PyErr_NoMemory();
+ goto error;
}
-
- Py_ssize_t size = sqlite3_value_bytes(cur_value);
- cur_py_value = PyUnicode_FromStringAndSize(text, size);
+
+ Py_ssize_t size = sqlite3_value_bytes(cur_value);
+ cur_py_value = PyUnicode_FromStringAndSize(text, size);
break;
- }
+ }
case SQLITE_BLOB:
buflen = sqlite3_value_bytes(cur_value);
cur_py_value = PyBytes_FromStringAndSize(
@@ -599,7 +599,7 @@ PyObject* _pysqlite_build_py_params(sqlite3_context *context, int argc, sqlite3_
}
if (!cur_py_value) {
- goto error;
+ goto error;
}
PyTuple_SetItem(args, i, cur_py_value);
@@ -607,10 +607,10 @@ PyObject* _pysqlite_build_py_params(sqlite3_context *context, int argc, sqlite3_
}
return args;
-
-error:
- Py_DECREF(args);
- return NULL;
+
+error:
+ Py_DECREF(args);
+ return NULL;
}
void _pysqlite_func_callback(sqlite3_context* context, int argc, sqlite3_value** argv)
@@ -734,7 +734,7 @@ void _pysqlite_final_callback(sqlite3_context* context)
PyErr_Fetch(&exception, &value, &tb);
restore = 1;
- function_result = _PyObject_CallMethodIdNoArgs(*aggregate_instance, &PyId_finalize);
+ function_result = _PyObject_CallMethodIdNoArgs(*aggregate_instance, &PyId_finalize);
Py_DECREF(*aggregate_instance);
@@ -829,56 +829,56 @@ static void _pysqlite_drop_unused_cursor_references(pysqlite_Connection* self)
Py_SETREF(self->cursors, new_list);
}
-static void _destructor(void* args)
-{
- Py_DECREF((PyObject*)args);
-}
-
+static void _destructor(void* args)
+{
+ Py_DECREF((PyObject*)args);
+}
+
PyObject* pysqlite_connection_create_function(pysqlite_Connection* self, PyObject* args, PyObject* kwargs)
{
- static char *kwlist[] = {"name", "narg", "func", "deterministic", NULL};
+ static char *kwlist[] = {"name", "narg", "func", "deterministic", NULL};
PyObject* func;
char* name;
int narg;
int rc;
- int deterministic = 0;
- int flags = SQLITE_UTF8;
+ int deterministic = 0;
+ int flags = SQLITE_UTF8;
if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
return NULL;
}
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "siO|$p", kwlist,
- &name, &narg, &func, &deterministic))
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "siO|$p", kwlist,
+ &name, &narg, &func, &deterministic))
{
return NULL;
}
- if (deterministic) {
-#if SQLITE_VERSION_NUMBER < 3008003
- PyErr_SetString(pysqlite_NotSupportedError,
- "deterministic=True requires SQLite 3.8.3 or higher");
+ if (deterministic) {
+#if SQLITE_VERSION_NUMBER < 3008003
+ PyErr_SetString(pysqlite_NotSupportedError,
+ "deterministic=True requires SQLite 3.8.3 or higher");
return NULL;
-#else
- if (sqlite3_libversion_number() < 3008003) {
- PyErr_SetString(pysqlite_NotSupportedError,
- "deterministic=True requires SQLite 3.8.3 or higher");
- return NULL;
- }
- flags |= SQLITE_DETERMINISTIC;
-#endif
- }
- Py_INCREF(func);
- rc = sqlite3_create_function_v2(self->db,
- name,
- narg,
- flags,
- (void*)func,
- _pysqlite_func_callback,
- NULL,
- NULL,
- &_destructor); // will decref func
+#else
+ if (sqlite3_libversion_number() < 3008003) {
+ PyErr_SetString(pysqlite_NotSupportedError,
+ "deterministic=True requires SQLite 3.8.3 or higher");
+ return NULL;
+ }
+ flags |= SQLITE_DETERMINISTIC;
+#endif
+ }
+ Py_INCREF(func);
+ rc = sqlite3_create_function_v2(self->db,
+ name,
+ narg,
+ flags,
+ (void*)func,
+ _pysqlite_func_callback,
+ NULL,
+ NULL,
+ &_destructor); // will decref func
if (rc != SQLITE_OK) {
/* Workaround for SQLite bug: no error code or string is available here */
@@ -905,16 +905,16 @@ PyObject* pysqlite_connection_create_aggregate(pysqlite_Connection* self, PyObje
kwlist, &name, &n_arg, &aggregate_class)) {
return NULL;
}
- Py_INCREF(aggregate_class);
- rc = sqlite3_create_function_v2(self->db,
- name,
- n_arg,
- SQLITE_UTF8,
- (void*)aggregate_class,
- 0,
- &_pysqlite_step_callback,
- &_pysqlite_final_callback,
- &_destructor); // will decref func
+ Py_INCREF(aggregate_class);
+ rc = sqlite3_create_function_v2(self->db,
+ name,
+ n_arg,
+ SQLITE_UTF8,
+ (void*)aggregate_class,
+ 0,
+ &_pysqlite_step_callback,
+ &_pysqlite_final_callback,
+ &_destructor); // will decref func
if (rc != SQLITE_OK) {
/* Workaround for SQLite bug: no error code or string is available here */
PyErr_SetString(pysqlite_OperationalError, "Error creating aggregate");
@@ -1000,7 +1000,7 @@ static void _trace_callback(void* user_arg, const char* statement_string)
py_statement = PyUnicode_DecodeUTF8(statement_string,
strlen(statement_string), "replace");
if (py_statement) {
- ret = PyObject_CallOneArg((PyObject*)user_arg, py_statement);
+ ret = PyObject_CallOneArg((PyObject*)user_arg, py_statement);
Py_DECREF(py_statement);
}
@@ -1036,11 +1036,11 @@ static PyObject* pysqlite_connection_set_authorizer(pysqlite_Connection* self, P
rc = sqlite3_set_authorizer(self->db, _authorizer_callback, (void*)authorizer_cb);
if (rc != SQLITE_OK) {
PyErr_SetString(pysqlite_OperationalError, "Error setting authorizer callback");
- Py_XSETREF(self->function_pinboard_authorizer_cb, NULL);
+ Py_XSETREF(self->function_pinboard_authorizer_cb, NULL);
return NULL;
- } else {
- Py_INCREF(authorizer_cb);
- Py_XSETREF(self->function_pinboard_authorizer_cb, authorizer_cb);
+ } else {
+ Py_INCREF(authorizer_cb);
+ Py_XSETREF(self->function_pinboard_authorizer_cb, authorizer_cb);
}
Py_RETURN_NONE;
}
@@ -1064,11 +1064,11 @@ static PyObject* pysqlite_connection_set_progress_handler(pysqlite_Connection* s
if (progress_handler == Py_None) {
/* None clears the progress handler previously set */
sqlite3_progress_handler(self->db, 0, 0, (void*)0);
- Py_XSETREF(self->function_pinboard_progress_handler, NULL);
+ Py_XSETREF(self->function_pinboard_progress_handler, NULL);
} else {
sqlite3_progress_handler(self->db, n, _progress_handler, progress_handler);
- Py_INCREF(progress_handler);
- Py_XSETREF(self->function_pinboard_progress_handler, progress_handler);
+ Py_INCREF(progress_handler);
+ Py_XSETREF(self->function_pinboard_progress_handler, progress_handler);
}
Py_RETURN_NONE;
}
@@ -1091,11 +1091,11 @@ static PyObject* pysqlite_connection_set_trace_callback(pysqlite_Connection* sel
if (trace_callback == Py_None) {
/* None clears the trace callback previously set */
sqlite3_trace(self->db, 0, (void*)0);
- Py_XSETREF(self->function_pinboard_trace_callback, NULL);
+ Py_XSETREF(self->function_pinboard_trace_callback, NULL);
} else {
sqlite3_trace(self->db, _trace_callback, trace_callback);
- Py_INCREF(trace_callback);
- Py_XSETREF(self->function_pinboard_trace_callback, trace_callback);
+ Py_INCREF(trace_callback);
+ Py_XSETREF(self->function_pinboard_trace_callback, trace_callback);
}
Py_RETURN_NONE;
@@ -1166,9 +1166,9 @@ int pysqlite_check_thread(pysqlite_Connection* self)
static PyObject* pysqlite_connection_get_isolation_level(pysqlite_Connection* self, void* unused)
{
- if (!pysqlite_check_connection(self)) {
- return NULL;
- }
+ if (!pysqlite_check_connection(self)) {
+ return NULL;
+ }
Py_INCREF(self->isolation_level);
return self->isolation_level;
}
@@ -1201,16 +1201,16 @@ pysqlite_connection_set_isolation_level(pysqlite_Connection* self, PyObject* iso
return -1;
}
if (isolation_level == Py_None) {
- /* We might get called during connection init, so we cannot use
- * pysqlite_connection_commit() here. */
- if (self->db && !sqlite3_get_autocommit(self->db)) {
- int rc;
- Py_BEGIN_ALLOW_THREADS
- rc = sqlite3_exec(self->db, "COMMIT", NULL, NULL, NULL);
- Py_END_ALLOW_THREADS
- if (rc != SQLITE_OK) {
- return _pysqlite_seterror(self->db, NULL);
- }
+ /* We might get called during connection init, so we cannot use
+ * pysqlite_connection_commit() here. */
+ if (self->db && !sqlite3_get_autocommit(self->db)) {
+ int rc;
+ Py_BEGIN_ALLOW_THREADS
+ rc = sqlite3_exec(self->db, "COMMIT", NULL, NULL, NULL);
+ Py_END_ALLOW_THREADS
+ if (rc != SQLITE_OK) {
+ return _pysqlite_seterror(self->db, NULL);
+ }
}
self->begin_statement = NULL;
@@ -1226,9 +1226,9 @@ pysqlite_connection_set_isolation_level(pysqlite_Connection* self, PyObject* iso
return -1;
}
- uppercase_level = _PyObject_CallMethodIdOneArg(
+ uppercase_level = _PyObject_CallMethodIdOneArg(
(PyObject *)&PyUnicode_Type, &PyId_upper,
- isolation_level);
+ isolation_level);
if (!uppercase_level) {
return -1;
}
@@ -1264,7 +1264,7 @@ PyObject* pysqlite_connection_call(pysqlite_Connection* self, PyObject* args, Py
if (!_PyArg_NoKeywords(MODULE_NAME ".Connection", kwargs))
return NULL;
- if (!PyArg_ParseTuple(args, "U", &sql))
+ if (!PyArg_ParseTuple(args, "U", &sql))
return NULL;
_pysqlite_drop_unused_statement_references(self);
@@ -1316,7 +1316,7 @@ PyObject* pysqlite_connection_execute(pysqlite_Connection* self, PyObject* args)
PyObject* result = 0;
PyObject* method = 0;
- cursor = _PyObject_CallMethodIdNoArgs((PyObject*)self, &PyId_cursor);
+ cursor = _PyObject_CallMethodIdNoArgs((PyObject*)self, &PyId_cursor);
if (!cursor) {
goto error;
}
@@ -1345,7 +1345,7 @@ PyObject* pysqlite_connection_executemany(pysqlite_Connection* self, PyObject* a
PyObject* result = 0;
PyObject* method = 0;
- cursor = _PyObject_CallMethodIdNoArgs((PyObject*)self, &PyId_cursor);
+ cursor = _PyObject_CallMethodIdNoArgs((PyObject*)self, &PyId_cursor);
if (!cursor) {
goto error;
}
@@ -1374,7 +1374,7 @@ PyObject* pysqlite_connection_executescript(pysqlite_Connection* self, PyObject*
PyObject* result = 0;
PyObject* method = 0;
- cursor = _PyObject_CallMethodIdNoArgs((PyObject*)self, &PyId_cursor);
+ cursor = _PyObject_CallMethodIdNoArgs((PyObject*)self, &PyId_cursor);
if (!cursor) {
goto error;
}
@@ -1477,7 +1477,7 @@ finally:
static PyObject *
pysqlite_connection_iterdump(pysqlite_Connection* self, PyObject* args)
{
- _Py_IDENTIFIER(_iterdump);
+ _Py_IDENTIFIER(_iterdump);
PyObject* retval = NULL;
PyObject* module = NULL;
PyObject* module_dict;
@@ -1497,16 +1497,16 @@ pysqlite_connection_iterdump(pysqlite_Connection* self, PyObject* args)
goto finally;
}
- pyfn_iterdump = _PyDict_GetItemIdWithError(module_dict, &PyId__iterdump);
+ pyfn_iterdump = _PyDict_GetItemIdWithError(module_dict, &PyId__iterdump);
if (!pyfn_iterdump) {
- if (!PyErr_Occurred()) {
- PyErr_SetString(pysqlite_OperationalError,
- "Failed to obtain _iterdump() reference");
- }
+ if (!PyErr_Occurred()) {
+ PyErr_SetString(pysqlite_OperationalError,
+ "Failed to obtain _iterdump() reference");
+ }
goto finally;
}
- retval = PyObject_CallOneArg(pyfn_iterdump, (PyObject *)self);
+ retval = PyObject_CallOneArg(pyfn_iterdump, (PyObject *)self);
finally:
Py_XDECREF(module);
@@ -1523,37 +1523,37 @@ pysqlite_connection_backup(pysqlite_Connection *self, PyObject *args, PyObject *
const char *name = "main";
int rc;
int callback_error = 0;
- PyObject *sleep_obj = NULL;
- int sleep_ms = 250;
+ PyObject *sleep_obj = NULL;
+ int sleep_ms = 250;
sqlite3 *bck_conn;
sqlite3_backup *bck_handle;
static char *keywords[] = {"target", "pages", "progress", "name", "sleep", NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!|$iOsO:backup", keywords,
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!|$iOsO:backup", keywords,
&pysqlite_ConnectionType, &target,
- &pages, &progress, &name, &sleep_obj)) {
- return NULL;
- }
-
- if (sleep_obj != NULL) {
- _PyTime_t sleep_secs;
- if (_PyTime_FromSecondsObject(&sleep_secs, sleep_obj,
- _PyTime_ROUND_TIMEOUT)) {
- return NULL;
- }
- _PyTime_t ms = _PyTime_AsMilliseconds(sleep_secs,
- _PyTime_ROUND_TIMEOUT);
- if (ms < INT_MIN || ms > INT_MAX) {
- PyErr_SetString(PyExc_OverflowError, "sleep is too large");
- return NULL;
- }
- sleep_ms = (int)ms;
- }
-
- if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
+ &pages, &progress, &name, &sleep_obj)) {
return NULL;
}
+ if (sleep_obj != NULL) {
+ _PyTime_t sleep_secs;
+ if (_PyTime_FromSecondsObject(&sleep_secs, sleep_obj,
+ _PyTime_ROUND_TIMEOUT)) {
+ return NULL;
+ }
+ _PyTime_t ms = _PyTime_AsMilliseconds(sleep_secs,
+ _PyTime_ROUND_TIMEOUT);
+ if (ms < INT_MIN || ms > INT_MAX) {
+ PyErr_SetString(PyExc_OverflowError, "sleep is too large");
+ return NULL;
+ }
+ sleep_ms = (int)ms;
+ }
+
+ if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
+ return NULL;
+ }
+
if (!pysqlite_check_connection((pysqlite_Connection *)target)) {
return NULL;
}
@@ -1613,7 +1613,7 @@ pysqlite_connection_backup(pysqlite_Connection *self, PyObject *args, PyObject *
the engine could not make any progress */
if (rc == SQLITE_BUSY || rc == SQLITE_LOCKED) {
Py_BEGIN_ALLOW_THREADS
- sqlite3_sleep(sleep_ms);
+ sqlite3_sleep(sleep_ms);
Py_END_ALLOW_THREADS
}
} while (rc == SQLITE_OK || rc == SQLITE_BUSY || rc == SQLITE_LOCKED);
@@ -1682,7 +1682,7 @@ pysqlite_connection_create_collation(pysqlite_Connection* self, PyObject* args)
const char *uppercase_name_str;
int rc;
unsigned int kind;
- const void *data;
+ const void *data;
if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
goto finally;
@@ -1693,8 +1693,8 @@ pysqlite_connection_create_collation(pysqlite_Connection* self, PyObject* args)
goto finally;
}
- uppercase_name = _PyObject_CallMethodIdOneArg((PyObject *)&PyUnicode_Type,
- &PyId_upper, name);
+ uppercase_name = _PyObject_CallMethodIdOneArg((PyObject *)&PyUnicode_Type,
+ &PyId_upper, name);
if (!uppercase_name) {
goto finally;
}
@@ -1740,11 +1740,11 @@ pysqlite_connection_create_collation(pysqlite_Connection* self, PyObject* args)
(callable != Py_None) ? callable : NULL,
(callable != Py_None) ? pysqlite_collation_callback : NULL);
if (rc != SQLITE_OK) {
- if (callable != Py_None) {
- if (PyDict_DelItem(self->collations, uppercase_name) < 0) {
- PyErr_Clear();
- }
- }
+ if (callable != Py_None) {
+ if (PyDict_DelItem(self->collations, uppercase_name) < 0) {
+ PyErr_Clear();
+ }
+ }
_pysqlite_seterror(self->db, NULL);
goto finally;
}
@@ -1776,36 +1776,36 @@ pysqlite_connection_enter(pysqlite_Connection* self, PyObject* args)
static PyObject *
pysqlite_connection_exit(pysqlite_Connection* self, PyObject* args)
{
- PyObject *exc_type, *exc_value, *exc_tb;
+ PyObject *exc_type, *exc_value, *exc_tb;
if (!PyArg_ParseTuple(args, "OOO", &exc_type, &exc_value, &exc_tb)) {
return NULL;
}
- int commit = 0;
- PyObject *result;
+ int commit = 0;
+ PyObject *result;
if (exc_type == Py_None && exc_value == Py_None && exc_tb == Py_None) {
- commit = 1;
- result = pysqlite_connection_commit(self, NULL);
- }
- else {
- result = pysqlite_connection_rollback(self, NULL);
- }
-
- if (result == NULL) {
- if (commit) {
- /* Commit failed; try to rollback in order to unlock the database.
- * If rollback also fails, chain the exceptions. */
- PyObject *exc, *val, *tb;
- PyErr_Fetch(&exc, &val, &tb);
- result = pysqlite_connection_rollback(self, NULL);
- if (result == NULL) {
- _PyErr_ChainExceptions(exc, val, tb);
- }
- else {
- Py_DECREF(result);
- PyErr_Restore(exc, val, tb);
- }
- }
+ commit = 1;
+ result = pysqlite_connection_commit(self, NULL);
+ }
+ else {
+ result = pysqlite_connection_rollback(self, NULL);
+ }
+
+ if (result == NULL) {
+ if (commit) {
+ /* Commit failed; try to rollback in order to unlock the database.
+ * If rollback also fails, chain the exceptions. */
+ PyObject *exc, *val, *tb;
+ PyErr_Fetch(&exc, &val, &tb);
+ result = pysqlite_connection_rollback(self, NULL);
+ if (result == NULL) {
+ _PyErr_ChainExceptions(exc, val, tb);
+ }
+ else {
+ Py_DECREF(result);
+ PyErr_Restore(exc, val, tb);
+ }
+ }
return NULL;
}
Py_DECREF(result);
@@ -1824,7 +1824,7 @@ static PyGetSetDef connection_getset[] = {
};
static PyMethodDef connection_methods[] = {
- {"cursor", (PyCFunction)(void(*)(void))pysqlite_connection_cursor, METH_VARARGS|METH_KEYWORDS,
+ {"cursor", (PyCFunction)(void(*)(void))pysqlite_connection_cursor, METH_VARARGS|METH_KEYWORDS,
PyDoc_STR("Return a cursor for the connection.")},
{"close", (PyCFunction)pysqlite_connection_close, METH_NOARGS,
PyDoc_STR("Closes the connection.")},
@@ -1832,11 +1832,11 @@ static PyMethodDef connection_methods[] = {
PyDoc_STR("Commit the current transaction.")},
{"rollback", (PyCFunction)pysqlite_connection_rollback, METH_NOARGS,
PyDoc_STR("Roll back the current transaction.")},
- {"create_function", (PyCFunction)(void(*)(void))pysqlite_connection_create_function, METH_VARARGS|METH_KEYWORDS,
+ {"create_function", (PyCFunction)(void(*)(void))pysqlite_connection_create_function, METH_VARARGS|METH_KEYWORDS,
PyDoc_STR("Creates a new function. Non-standard.")},
- {"create_aggregate", (PyCFunction)(void(*)(void))pysqlite_connection_create_aggregate, METH_VARARGS|METH_KEYWORDS,
+ {"create_aggregate", (PyCFunction)(void(*)(void))pysqlite_connection_create_aggregate, METH_VARARGS|METH_KEYWORDS,
PyDoc_STR("Creates a new aggregate. Non-standard.")},
- {"set_authorizer", (PyCFunction)(void(*)(void))pysqlite_connection_set_authorizer, METH_VARARGS|METH_KEYWORDS,
+ {"set_authorizer", (PyCFunction)(void(*)(void))pysqlite_connection_set_authorizer, METH_VARARGS|METH_KEYWORDS,
PyDoc_STR("Sets authorizer callback. Non-standard.")},
#ifdef HAVE_LOAD_EXTENSION
{"enable_load_extension", (PyCFunction)pysqlite_enable_load_extension, METH_VARARGS,
@@ -1844,9 +1844,9 @@ static PyMethodDef connection_methods[] = {
{"load_extension", (PyCFunction)pysqlite_load_extension, METH_VARARGS,
PyDoc_STR("Load SQLite extension module. Non-standard.")},
#endif
- {"set_progress_handler", (PyCFunction)(void(*)(void))pysqlite_connection_set_progress_handler, METH_VARARGS|METH_KEYWORDS,
+ {"set_progress_handler", (PyCFunction)(void(*)(void))pysqlite_connection_set_progress_handler, METH_VARARGS|METH_KEYWORDS,
PyDoc_STR("Sets progress handler callback. Non-standard.")},
- {"set_trace_callback", (PyCFunction)(void(*)(void))pysqlite_connection_set_trace_callback, METH_VARARGS|METH_KEYWORDS,
+ {"set_trace_callback", (PyCFunction)(void(*)(void))pysqlite_connection_set_trace_callback, METH_VARARGS|METH_KEYWORDS,
PyDoc_STR("Sets a trace callback called for each SQL statement (passed as unicode). Non-standard.")},
{"execute", (PyCFunction)pysqlite_connection_execute, METH_VARARGS,
PyDoc_STR("Executes a SQL statement. Non-standard.")},
@@ -1861,7 +1861,7 @@ static PyMethodDef connection_methods[] = {
{"iterdump", (PyCFunction)pysqlite_connection_iterdump, METH_NOARGS,
PyDoc_STR("Returns iterator to the dump of the database in an SQL text format. Non-standard.")},
#ifdef HAVE_BACKUP_API
- {"backup", (PyCFunction)(void(*)(void))pysqlite_connection_backup, METH_VARARGS | METH_KEYWORDS,
+ {"backup", (PyCFunction)(void(*)(void))pysqlite_connection_backup, METH_VARARGS | METH_KEYWORDS,
PyDoc_STR("Makes a backup of the database. Non-standard.")},
#endif
{"__enter__", (PyCFunction)pysqlite_connection_enter, METH_NOARGS,
@@ -1894,10 +1894,10 @@ PyTypeObject pysqlite_ConnectionType = {
sizeof(pysqlite_Connection), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)pysqlite_connection_dealloc, /* tp_dealloc */
- 0, /* tp_vectorcall_offset */
+ 0, /* tp_vectorcall_offset */
0, /* tp_getattr */
0, /* tp_setattr */
- 0, /* tp_as_async */
+ 0, /* tp_as_async */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
diff --git a/contrib/tools/python3/src/Modules/_sqlite/connection.h b/contrib/tools/python3/src/Modules/_sqlite/connection.h
index 206085e00a..437de6ebd5 100644
--- a/contrib/tools/python3/src/Modules/_sqlite/connection.h
+++ b/contrib/tools/python3/src/Modules/_sqlite/connection.h
@@ -23,7 +23,7 @@
#ifndef PYSQLITE_CONNECTION_H
#define PYSQLITE_CONNECTION_H
-#define PY_SSIZE_T_CLEAN
+#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "pythread.h"
#include "structmember.h"
@@ -85,10 +85,10 @@ typedef struct
*/
PyObject* text_factory;
- /* remember references to object used in trace_callback/progress_handler/authorizer_cb */
- PyObject* function_pinboard_trace_callback;
- PyObject* function_pinboard_progress_handler;
- PyObject* function_pinboard_authorizer_cb;
+ /* remember references to object used in trace_callback/progress_handler/authorizer_cb */
+ PyObject* function_pinboard_trace_callback;
+ PyObject* function_pinboard_progress_handler;
+ PyObject* function_pinboard_authorizer_cb;
/* a dictionary of registered collation name => collation callable mappings */
PyObject* collations;
diff --git a/contrib/tools/python3/src/Modules/_sqlite/cursor.c b/contrib/tools/python3/src/Modules/_sqlite/cursor.c
index dd0ce7e1ea..ff6b0783df 100644
--- a/contrib/tools/python3/src/Modules/_sqlite/cursor.c
+++ b/contrib/tools/python3/src/Modules/_sqlite/cursor.c
@@ -42,7 +42,7 @@ static int pysqlite_cursor_init(pysqlite_Cursor* self, PyObject* args, PyObject*
Py_XSETREF(self->connection, connection);
Py_CLEAR(self->statement);
Py_CLEAR(self->next_row);
- Py_CLEAR(self->row_cast_map);
+ Py_CLEAR(self->row_cast_map);
Py_INCREF(Py_None);
Py_XSETREF(self->description, Py_None);
@@ -94,32 +94,32 @@ static void pysqlite_cursor_dealloc(pysqlite_Cursor* self)
Py_TYPE(self)->tp_free((PyObject*)self);
}
-static PyObject *
-_pysqlite_get_converter(const char *keystr, Py_ssize_t keylen)
+static PyObject *
+_pysqlite_get_converter(const char *keystr, Py_ssize_t keylen)
{
- PyObject *key;
- PyObject *upcase_key;
- PyObject *retval;
+ PyObject *key;
+ PyObject *upcase_key;
+ PyObject *retval;
_Py_IDENTIFIER(upper);
- key = PyUnicode_FromStringAndSize(keystr, keylen);
- if (!key) {
- return NULL;
- }
- upcase_key = _PyObject_CallMethodIdNoArgs(key, &PyId_upper);
- Py_DECREF(key);
+ key = PyUnicode_FromStringAndSize(keystr, keylen);
+ if (!key) {
+ return NULL;
+ }
+ upcase_key = _PyObject_CallMethodIdNoArgs(key, &PyId_upper);
+ Py_DECREF(key);
if (!upcase_key) {
return NULL;
}
- retval = PyDict_GetItemWithError(_pysqlite_converters, upcase_key);
+ retval = PyDict_GetItemWithError(_pysqlite_converters, upcase_key);
Py_DECREF(upcase_key);
return retval;
}
-static int
-pysqlite_build_row_cast_map(pysqlite_Cursor* self)
+static int
+pysqlite_build_row_cast_map(pysqlite_Cursor* self)
{
int i;
const char* pos;
@@ -132,9 +132,9 @@ pysqlite_build_row_cast_map(pysqlite_Cursor* self)
}
Py_XSETREF(self->row_cast_map, PyList_New(0));
- if (!self->row_cast_map) {
- return -1;
- }
+ if (!self->row_cast_map) {
+ return -1;
+ }
for (i = 0; i < sqlite3_column_count(self->statement->st); i++) {
converter = NULL;
@@ -142,16 +142,16 @@ pysqlite_build_row_cast_map(pysqlite_Cursor* self)
if (self->connection->detect_types & PARSE_COLNAMES) {
colname = sqlite3_column_name(self->statement->st, i);
if (colname) {
- const char *type_start = NULL;
+ const char *type_start = NULL;
for (pos = colname; *pos != 0; pos++) {
if (*pos == '[') {
type_start = pos + 1;
- }
- else if (*pos == ']' && type_start != NULL) {
- converter = _pysqlite_get_converter(type_start, pos - type_start);
- if (!converter && PyErr_Occurred()) {
- Py_CLEAR(self->row_cast_map);
- return -1;
+ }
+ else if (*pos == ']' && type_start != NULL) {
+ converter = _pysqlite_get_converter(type_start, pos - type_start);
+ if (!converter && PyErr_Occurred()) {
+ Py_CLEAR(self->row_cast_map);
+ return -1;
}
break;
}
@@ -168,9 +168,9 @@ pysqlite_build_row_cast_map(pysqlite_Cursor* self)
* 'NUMBER(10)' to be treated as 'NUMBER', for example.
* In other words, it will work as people expect it to work.*/
if (*pos == ' ' || *pos == '(' || *pos == 0) {
- converter = _pysqlite_get_converter(decltype, pos - decltype);
- if (!converter && PyErr_Occurred()) {
- Py_CLEAR(self->row_cast_map);
+ converter = _pysqlite_get_converter(decltype, pos - decltype);
+ if (!converter && PyErr_Occurred()) {
+ Py_CLEAR(self->row_cast_map);
return -1;
}
break;
@@ -192,31 +192,31 @@ pysqlite_build_row_cast_map(pysqlite_Cursor* self)
return 0;
}
-static PyObject *
-_pysqlite_build_column_name(pysqlite_Cursor *self, const char *colname)
+static PyObject *
+_pysqlite_build_column_name(pysqlite_Cursor *self, const char *colname)
{
const char* pos;
- Py_ssize_t len;
+ Py_ssize_t len;
if (!colname) {
Py_RETURN_NONE;
}
- if (self->connection->detect_types & PARSE_COLNAMES) {
- for (pos = colname; *pos; pos++) {
- if (*pos == '[') {
- if ((pos != colname) && (*(pos-1) == ' ')) {
- pos--;
- }
- break;
+ if (self->connection->detect_types & PARSE_COLNAMES) {
+ for (pos = colname; *pos; pos++) {
+ if (*pos == '[') {
+ if ((pos != colname) && (*(pos-1) == ' ')) {
+ pos--;
+ }
+ break;
}
}
- len = pos - colname;
+ len = pos - colname;
}
- else {
- len = strlen(colname);
- }
- return PyUnicode_FromStringAndSize(colname, len);
+ else {
+ len = strlen(colname);
+ }
+ return PyUnicode_FromStringAndSize(colname, len);
}
/*
@@ -225,8 +225,8 @@ _pysqlite_build_column_name(pysqlite_Cursor *self, const char *colname)
* Precondidition:
* - sqlite3_step() has been called before and it returned SQLITE_ROW.
*/
-static PyObject *
-_pysqlite_fetch_one_row(pysqlite_Cursor* self)
+static PyObject *
+_pysqlite_fetch_one_row(pysqlite_Cursor* self)
{
int i, numcols;
PyObject* row;
@@ -238,7 +238,7 @@ _pysqlite_fetch_one_row(pysqlite_Cursor* self)
const char* val_str;
char buf[200];
const char* colname;
- PyObject* error_msg;
+ PyObject* error_msg;
if (self->reset) {
PyErr_SetString(pysqlite_InterfaceError, errmsg_fetch_across_rollback);
@@ -254,13 +254,13 @@ _pysqlite_fetch_one_row(pysqlite_Cursor* self)
return NULL;
for (i = 0; i < numcols; i++) {
- if (self->connection->detect_types
- && self->row_cast_map != NULL
- && i < PyList_GET_SIZE(self->row_cast_map))
- {
- converter = PyList_GET_ITEM(self->row_cast_map, i);
- }
- else {
+ if (self->connection->detect_types
+ && self->row_cast_map != NULL
+ && i < PyList_GET_SIZE(self->row_cast_map))
+ {
+ converter = PyList_GET_ITEM(self->row_cast_map, i);
+ }
+ else {
converter = Py_None;
}
@@ -274,7 +274,7 @@ _pysqlite_fetch_one_row(pysqlite_Cursor* self)
item = PyBytes_FromStringAndSize(val_str, nbytes);
if (!item)
goto error;
- converted = PyObject_CallOneArg(converter, item);
+ converted = PyObject_CallOneArg(converter, item);
Py_DECREF(item);
}
} else {
@@ -285,7 +285,7 @@ _pysqlite_fetch_one_row(pysqlite_Cursor* self)
Py_INCREF(Py_None);
converted = Py_None;
} else if (coltype == SQLITE_INTEGER) {
- converted = PyLong_FromLongLong(sqlite3_column_int64(self->statement->st, i));
+ converted = PyLong_FromLongLong(sqlite3_column_int64(self->statement->st, i));
} else if (coltype == SQLITE_FLOAT) {
converted = PyFloat_FromDouble(sqlite3_column_double(self->statement->st, i));
} else if (coltype == SQLITE_TEXT) {
@@ -293,7 +293,7 @@ _pysqlite_fetch_one_row(pysqlite_Cursor* self)
nbytes = sqlite3_column_bytes(self->statement->st, i);
if (self->connection->text_factory == (PyObject*)&PyUnicode_Type) {
converted = PyUnicode_FromStringAndSize(val_str, nbytes);
- if (!converted && PyErr_ExceptionMatches(PyExc_UnicodeDecodeError)) {
+ if (!converted && PyErr_ExceptionMatches(PyExc_UnicodeDecodeError)) {
PyErr_Clear();
colname = sqlite3_column_name(self->statement->st, i);
if (!colname) {
@@ -301,12 +301,12 @@ _pysqlite_fetch_one_row(pysqlite_Cursor* self)
}
PyOS_snprintf(buf, sizeof(buf) - 1, "Could not decode to UTF-8 column '%s' with text '%s'",
colname , val_str);
- error_msg = PyUnicode_Decode(buf, strlen(buf), "ascii", "replace");
- if (!error_msg) {
+ error_msg = PyUnicode_Decode(buf, strlen(buf), "ascii", "replace");
+ if (!error_msg) {
PyErr_SetString(pysqlite_OperationalError, "Could not decode to UTF-8");
} else {
- PyErr_SetObject(pysqlite_OperationalError, error_msg);
- Py_DECREF(error_msg);
+ PyErr_SetObject(pysqlite_OperationalError, error_msg);
+ Py_DECREF(error_msg);
}
}
} else if (self->connection->text_factory == (PyObject*)&PyBytes_Type) {
@@ -319,15 +319,15 @@ _pysqlite_fetch_one_row(pysqlite_Cursor* self)
} else {
/* coltype == SQLITE_BLOB */
nbytes = sqlite3_column_bytes(self->statement->st, i);
- converted = PyBytes_FromStringAndSize(
+ converted = PyBytes_FromStringAndSize(
sqlite3_column_blob(self->statement->st, i), nbytes);
}
}
- if (!converted) {
- goto error;
+ if (!converted) {
+ goto error;
}
- PyTuple_SetItem(row, i, converted);
+ PyTuple_SetItem(row, i, converted);
}
if (PyErr_Occurred())
@@ -365,8 +365,8 @@ static int check_cursor(pysqlite_Cursor* cur)
return pysqlite_check_thread(cur->connection) && pysqlite_check_connection(cur->connection);
}
-static PyObject *
-_pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* args)
+static PyObject *
+_pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* args)
{
PyObject* operation;
PyObject* parameters_list = NULL;
@@ -378,7 +378,7 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* args)
PyObject* result;
int numcols;
PyObject* descriptor;
- PyObject* column_name;
+ PyObject* column_name;
PyObject* second_argument = NULL;
sqlite_int64 lastrowid;
@@ -393,7 +393,7 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* args)
if (multiple) {
/* executemany() */
- if (!PyArg_ParseTuple(args, "UO", &operation, &second_argument)) {
+ if (!PyArg_ParseTuple(args, "UO", &operation, &second_argument)) {
goto error;
}
@@ -410,7 +410,7 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* args)
}
} else {
/* execute() */
- if (!PyArg_ParseTuple(args, "U|O", &operation, &second_argument)) {
+ if (!PyArg_ParseTuple(args, "U|O", &operation, &second_argument)) {
goto error;
}
@@ -527,7 +527,7 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* args)
}
if (pysqlite_build_row_cast_map(self) != 0) {
- _PyErr_FormatFromCause(pysqlite_OperationalError, "Error while building row_cast_map");
+ _PyErr_FormatFromCause(pysqlite_OperationalError, "Error while building row_cast_map");
goto error;
}
@@ -545,13 +545,13 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* args)
if (!descriptor) {
goto error;
}
- column_name = _pysqlite_build_column_name(self,
- sqlite3_column_name(self->statement->st, i));
- if (!column_name) {
- Py_DECREF(descriptor);
- goto error;
- }
- PyTuple_SetItem(descriptor, 0, column_name);
+ column_name = _pysqlite_build_column_name(self,
+ sqlite3_column_name(self->statement->st, i));
+ if (!column_name) {
+ Py_DECREF(descriptor);
+ goto error;
+ }
+ PyTuple_SetItem(descriptor, 0, column_name);
Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 1, Py_None);
Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 2, Py_None);
Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 3, Py_None);
@@ -572,10 +572,10 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* args)
Py_BEGIN_ALLOW_THREADS
lastrowid = sqlite3_last_insert_rowid(self->connection->db);
Py_END_ALLOW_THREADS
- Py_SETREF(self->lastrowid, PyLong_FromLongLong(lastrowid));
- if (self->lastrowid == NULL) {
- goto error;
- }
+ Py_SETREF(self->lastrowid, PyLong_FromLongLong(lastrowid));
+ if (self->lastrowid == NULL) {
+ goto error;
+ }
}
if (rc == SQLITE_ROW) {
@@ -624,8 +624,8 @@ PyObject* pysqlite_cursor_executemany(pysqlite_Cursor* self, PyObject* args)
return _pysqlite_query_execute(self, 1, args);
}
-static PyObject *
-pysqlite_cursor_executescript(pysqlite_Cursor* self, PyObject* args)
+static PyObject *
+pysqlite_cursor_executescript(pysqlite_Cursor* self, PyObject* args)
{
PyObject* script_obj;
const char* script_cstr;
@@ -787,7 +787,7 @@ PyObject* pysqlite_cursor_fetchone(pysqlite_Cursor* self, PyObject* args)
PyObject* pysqlite_cursor_fetchmany(pysqlite_Cursor* self, PyObject* args, PyObject* kwargs)
{
- static char *kwlist[] = {"size", NULL};
+ static char *kwlist[] = {"size", NULL};
PyObject* row;
PyObject* list;
@@ -803,12 +803,12 @@ PyObject* pysqlite_cursor_fetchmany(pysqlite_Cursor* self, PyObject* args, PyObj
return NULL;
}
- while ((row = pysqlite_cursor_iternext(self))) {
- if (PyList_Append(list, row) < 0) {
- Py_DECREF(row);
- break;
- }
- Py_DECREF(row);
+ while ((row = pysqlite_cursor_iternext(self))) {
+ if (PyList_Append(list, row) < 0) {
+ Py_DECREF(row);
+ break;
+ }
+ Py_DECREF(row);
if (++counter == maxrows) {
break;
@@ -833,12 +833,12 @@ PyObject* pysqlite_cursor_fetchall(pysqlite_Cursor* self, PyObject* args)
return NULL;
}
- while ((row = pysqlite_cursor_iternext(self))) {
- if (PyList_Append(list, row) < 0) {
- Py_DECREF(row);
- break;
- }
- Py_DECREF(row);
+ while ((row = pysqlite_cursor_iternext(self))) {
+ if (PyList_Append(list, row) < 0) {
+ Py_DECREF(row);
+ break;
+ }
+ Py_DECREF(row);
}
if (PyErr_Occurred()) {
@@ -885,7 +885,7 @@ static PyMethodDef cursor_methods[] = {
PyDoc_STR("Executes a multiple SQL statements at once. Non-standard.")},
{"fetchone", (PyCFunction)pysqlite_cursor_fetchone, METH_NOARGS,
PyDoc_STR("Fetches one row from the resultset.")},
- {"fetchmany", (PyCFunction)(void(*)(void))pysqlite_cursor_fetchmany, METH_VARARGS|METH_KEYWORDS,
+ {"fetchmany", (PyCFunction)(void(*)(void))pysqlite_cursor_fetchmany, METH_VARARGS|METH_KEYWORDS,
PyDoc_STR("Fetches several rows from the resultset.")},
{"fetchall", (PyCFunction)pysqlite_cursor_fetchall, METH_NOARGS,
PyDoc_STR("Fetches all rows from the resultset.")},
@@ -918,10 +918,10 @@ PyTypeObject pysqlite_CursorType = {
sizeof(pysqlite_Cursor), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)pysqlite_cursor_dealloc, /* tp_dealloc */
- 0, /* tp_vectorcall_offset */
+ 0, /* tp_vectorcall_offset */
0, /* tp_getattr */
0, /* tp_setattr */
- 0, /* tp_as_async */
+ 0, /* tp_as_async */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
@@ -938,7 +938,7 @@ PyTypeObject pysqlite_CursorType = {
0, /* tp_clear */
0, /* tp_richcompare */
offsetof(pysqlite_Cursor, in_weakreflist), /* tp_weaklistoffset */
- PyObject_SelfIter, /* tp_iter */
+ PyObject_SelfIter, /* tp_iter */
(iternextfunc)pysqlite_cursor_iternext, /* tp_iternext */
cursor_methods, /* tp_methods */
cursor_members, /* tp_members */
diff --git a/contrib/tools/python3/src/Modules/_sqlite/cursor.h b/contrib/tools/python3/src/Modules/_sqlite/cursor.h
index 4a20e756f7..04be589116 100644
--- a/contrib/tools/python3/src/Modules/_sqlite/cursor.h
+++ b/contrib/tools/python3/src/Modules/_sqlite/cursor.h
@@ -23,7 +23,7 @@
#ifndef PYSQLITE_CURSOR_H
#define PYSQLITE_CURSOR_H
-#define PY_SSIZE_T_CLEAN
+#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "statement.h"
diff --git a/contrib/tools/python3/src/Modules/_sqlite/microprotocols.c b/contrib/tools/python3/src/Modules/_sqlite/microprotocols.c
index 3b2d7f42b8..445221f85e 100644
--- a/contrib/tools/python3/src/Modules/_sqlite/microprotocols.c
+++ b/contrib/tools/python3/src/Modules/_sqlite/microprotocols.c
@@ -74,73 +74,73 @@ pysqlite_microprotocols_add(PyTypeObject *type, PyObject *proto, PyObject *cast)
PyObject *
pysqlite_microprotocols_adapt(PyObject *obj, PyObject *proto, PyObject *alt)
{
- _Py_IDENTIFIER(__adapt__);
- _Py_IDENTIFIER(__conform__);
- PyObject *adapter, *key, *adapted;
+ _Py_IDENTIFIER(__adapt__);
+ _Py_IDENTIFIER(__conform__);
+ PyObject *adapter, *key, *adapted;
/* we don't check for exact type conformance as specified in PEP 246
because the pysqlite_PrepareProtocolType type is abstract and there is no
way to get a quotable object to be its instance */
/* look for an adapter in the registry */
- key = Py_BuildValue("(OO)", (PyObject*)Py_TYPE(obj), proto);
+ key = Py_BuildValue("(OO)", (PyObject*)Py_TYPE(obj), proto);
if (!key) {
return NULL;
}
- adapter = PyDict_GetItemWithError(psyco_adapters, key);
+ adapter = PyDict_GetItemWithError(psyco_adapters, key);
Py_DECREF(key);
if (adapter) {
- Py_INCREF(adapter);
- adapted = PyObject_CallOneArg(adapter, obj);
- Py_DECREF(adapter);
+ Py_INCREF(adapter);
+ adapted = PyObject_CallOneArg(adapter, obj);
+ Py_DECREF(adapter);
return adapted;
}
- if (PyErr_Occurred()) {
- return NULL;
- }
-
- /* try to have the protocol adapt this object */
- if (_PyObject_LookupAttrId(proto, &PyId___adapt__, &adapter) < 0) {
- return NULL;
- }
- if (adapter) {
- adapted = PyObject_CallOneArg(adapter, obj);
- Py_DECREF(adapter);
-
- if (adapted == Py_None) {
- Py_DECREF(adapted);
- }
- else if (adapted || !PyErr_ExceptionMatches(PyExc_TypeError)) {
- return adapted;
- }
- else {
- PyErr_Clear();
+ if (PyErr_Occurred()) {
+ return NULL;
+ }
+
+ /* try to have the protocol adapt this object */
+ if (_PyObject_LookupAttrId(proto, &PyId___adapt__, &adapter) < 0) {
+ return NULL;
+ }
+ if (adapter) {
+ adapted = PyObject_CallOneArg(adapter, obj);
+ Py_DECREF(adapter);
+
+ if (adapted == Py_None) {
+ Py_DECREF(adapted);
}
+ else if (adapted || !PyErr_ExceptionMatches(PyExc_TypeError)) {
+ return adapted;
+ }
+ else {
+ PyErr_Clear();
+ }
}
/* and finally try to have the object adapt itself */
- if (_PyObject_LookupAttrId(obj, &PyId___conform__, &adapter) < 0) {
- return NULL;
- }
- if (adapter) {
- adapted = PyObject_CallOneArg(adapter, proto);
- Py_DECREF(adapter);
-
- if (adapted == Py_None) {
- Py_DECREF(adapted);
- }
- else if (adapted || !PyErr_ExceptionMatches(PyExc_TypeError)) {
- return adapted;
+ if (_PyObject_LookupAttrId(obj, &PyId___conform__, &adapter) < 0) {
+ return NULL;
+ }
+ if (adapter) {
+ adapted = PyObject_CallOneArg(adapter, proto);
+ Py_DECREF(adapter);
+
+ if (adapted == Py_None) {
+ Py_DECREF(adapted);
}
- else {
- PyErr_Clear();
+ else if (adapted || !PyErr_ExceptionMatches(PyExc_TypeError)) {
+ return adapted;
}
+ else {
+ PyErr_Clear();
+ }
}
- if (alt) {
- Py_INCREF(alt);
- return alt;
- }
+ if (alt) {
+ Py_INCREF(alt);
+ return alt;
+ }
/* else set the right exception and return NULL */
PyErr_SetString(pysqlite_ProgrammingError, "can't adapt");
return NULL;
diff --git a/contrib/tools/python3/src/Modules/_sqlite/microprotocols.h b/contrib/tools/python3/src/Modules/_sqlite/microprotocols.h
index 5418c2b98f..36a17dd58c 100644
--- a/contrib/tools/python3/src/Modules/_sqlite/microprotocols.h
+++ b/contrib/tools/python3/src/Modules/_sqlite/microprotocols.h
@@ -26,7 +26,7 @@
#ifndef PSYCOPG_MICROPROTOCOLS_H
#define PSYCOPG_MICROPROTOCOLS_H 1
-#define PY_SSIZE_T_CLEAN
+#define PY_SSIZE_T_CLEAN
#include <Python.h>
/** the names of the three mandatory methods **/
diff --git a/contrib/tools/python3/src/Modules/_sqlite/module.c b/contrib/tools/python3/src/Modules/_sqlite/module.c
index 44811835d4..5491f846cf 100644
--- a/contrib/tools/python3/src/Modules/_sqlite/module.c
+++ b/contrib/tools/python3/src/Modules/_sqlite/module.c
@@ -83,7 +83,7 @@ static PyObject* module_connect(PyObject* self, PyObject* args, PyObject*
factory = (PyObject*)&pysqlite_ConnectionType;
}
- return PyObject_Call(factory, args, kwargs);
+ return PyObject_Call(factory, args, kwargs);
}
PyDoc_STRVAR(module_connect_doc,
@@ -97,7 +97,7 @@ RAM instead of on disk.");
static PyObject* module_complete(PyObject* self, PyObject* args, PyObject*
kwargs)
{
- static char *kwlist[] = {"statement", NULL};
+ static char *kwlist[] = {"statement", NULL};
char* statement;
PyObject* result;
@@ -127,7 +127,7 @@ Checks if a string contains a complete SQL statement. Non-standard.");
static PyObject* module_enable_shared_cache(PyObject* self, PyObject* args, PyObject*
kwargs)
{
- static char *kwlist[] = {"do_enable", NULL};
+ static char *kwlist[] = {"do_enable", NULL};
int do_enable;
int rc;
@@ -195,7 +195,7 @@ static PyObject* module_register_converter(PyObject* self, PyObject* args)
}
/* convert the name to upper case */
- name = _PyObject_CallMethodIdNoArgs(orig_name, &PyId_upper);
+ name = _PyObject_CallMethodIdNoArgs(orig_name, &PyId_upper);
if (!name) {
goto error;
}
@@ -241,12 +241,12 @@ static void converters_init(PyObject* dict)
}
static PyMethodDef module_methods[] = {
- {"connect", (PyCFunction)(void(*)(void))module_connect,
+ {"connect", (PyCFunction)(void(*)(void))module_connect,
METH_VARARGS | METH_KEYWORDS, module_connect_doc},
- {"complete_statement", (PyCFunction)(void(*)(void))module_complete,
+ {"complete_statement", (PyCFunction)(void(*)(void))module_complete,
METH_VARARGS | METH_KEYWORDS, module_complete_doc},
#ifdef HAVE_SHARED_CACHE
- {"enable_shared_cache", (PyCFunction)(void(*)(void))module_enable_shared_cache,
+ {"enable_shared_cache", (PyCFunction)(void(*)(void))module_enable_shared_cache,
METH_VARARGS | METH_KEYWORDS, module_enable_shared_cache_doc},
#endif
{"register_adapter", (PyCFunction)module_register_adapter,
@@ -338,14 +338,14 @@ static struct PyModuleDef _sqlite3module = {
NULL
};
-#define ADD_TYPE(module, type) \
-do { \
- if (PyModule_AddType(module, &type) < 0) { \
- Py_DECREF(module); \
- return NULL; \
- } \
-} while (0)
-
+#define ADD_TYPE(module, type) \
+do { \
+ if (PyModule_AddType(module, &type) < 0) { \
+ Py_DECREF(module); \
+ return NULL; \
+ } \
+} while (0)
+
PyMODINIT_FUNC PyInit__sqlite3(void)
{
PyObject *module, *dict;
@@ -366,10 +366,10 @@ PyMODINIT_FUNC PyInit__sqlite3(void)
return NULL;
}
- ADD_TYPE(module, pysqlite_ConnectionType);
- ADD_TYPE(module, pysqlite_CursorType);
- ADD_TYPE(module, pysqlite_PrepareProtocolType);
- ADD_TYPE(module, pysqlite_RowType);
+ ADD_TYPE(module, pysqlite_ConnectionType);
+ ADD_TYPE(module, pysqlite_CursorType);
+ ADD_TYPE(module, pysqlite_PrepareProtocolType);
+ ADD_TYPE(module, pysqlite_RowType);
if (!(dict = PyModule_GetDict(module))) {
goto error;
diff --git a/contrib/tools/python3/src/Modules/_sqlite/module.h b/contrib/tools/python3/src/Modules/_sqlite/module.h
index 3185ec9788..b22c6c0677 100644
--- a/contrib/tools/python3/src/Modules/_sqlite/module.h
+++ b/contrib/tools/python3/src/Modules/_sqlite/module.h
@@ -23,7 +23,7 @@
#ifndef PYSQLITE_MODULE_H
#define PYSQLITE_MODULE_H
-#define PY_SSIZE_T_CLEAN
+#define PY_SSIZE_T_CLEAN
#include "Python.h"
#define PYSQLITE_VERSION "2.6.0"
diff --git a/contrib/tools/python3/src/Modules/_sqlite/prepare_protocol.c b/contrib/tools/python3/src/Modules/_sqlite/prepare_protocol.c
index 05a2ca5a65..f9fc2526bd 100644
--- a/contrib/tools/python3/src/Modules/_sqlite/prepare_protocol.c
+++ b/contrib/tools/python3/src/Modules/_sqlite/prepare_protocol.c
@@ -39,10 +39,10 @@ PyTypeObject pysqlite_PrepareProtocolType= {
sizeof(pysqlite_PrepareProtocol), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)pysqlite_prepare_protocol_dealloc, /* tp_dealloc */
- 0, /* tp_vectorcall_offset */
+ 0, /* tp_vectorcall_offset */
0, /* tp_getattr */
0, /* tp_setattr */
- 0, /* tp_as_async */
+ 0, /* tp_as_async */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
@@ -78,6 +78,6 @@ PyTypeObject pysqlite_PrepareProtocolType= {
extern int pysqlite_prepare_protocol_setup_types(void)
{
pysqlite_PrepareProtocolType.tp_new = PyType_GenericNew;
- Py_SET_TYPE(&pysqlite_PrepareProtocolType, &PyType_Type);
+ Py_SET_TYPE(&pysqlite_PrepareProtocolType, &PyType_Type);
return PyType_Ready(&pysqlite_PrepareProtocolType);
}
diff --git a/contrib/tools/python3/src/Modules/_sqlite/prepare_protocol.h b/contrib/tools/python3/src/Modules/_sqlite/prepare_protocol.h
index 3998a55e51..aa0b0d5b6b 100644
--- a/contrib/tools/python3/src/Modules/_sqlite/prepare_protocol.h
+++ b/contrib/tools/python3/src/Modules/_sqlite/prepare_protocol.h
@@ -23,7 +23,7 @@
#ifndef PYSQLITE_PREPARE_PROTOCOL_H
#define PYSQLITE_PREPARE_PROTOCOL_H
-#define PY_SSIZE_T_CLEAN
+#define PY_SSIZE_T_CLEAN
#include "Python.h"
typedef struct
diff --git a/contrib/tools/python3/src/Modules/_sqlite/row.c b/contrib/tools/python3/src/Modules/_sqlite/row.c
index 4b47108278..26416342c6 100644
--- a/contrib/tools/python3/src/Modules/_sqlite/row.c
+++ b/contrib/tools/python3/src/Modules/_sqlite/row.c
@@ -76,34 +76,34 @@ PyObject* pysqlite_row_item(pysqlite_Row* self, Py_ssize_t idx)
return item;
}
-static int
-equal_ignore_case(PyObject *left, PyObject *right)
-{
- int eq = PyObject_RichCompareBool(left, right, Py_EQ);
- if (eq) { /* equal or error */
- return eq;
- }
- if (!PyUnicode_Check(left) || !PyUnicode_Check(right)) {
- return 0;
- }
- if (!PyUnicode_IS_ASCII(left) || !PyUnicode_IS_ASCII(right)) {
- return 0;
- }
-
- Py_ssize_t len = PyUnicode_GET_LENGTH(left);
- if (PyUnicode_GET_LENGTH(right) != len) {
- return 0;
- }
- const Py_UCS1 *p1 = PyUnicode_1BYTE_DATA(left);
- const Py_UCS1 *p2 = PyUnicode_1BYTE_DATA(right);
- for (; len; len--, p1++, p2++) {
- if (Py_TOLOWER(*p1) != Py_TOLOWER(*p2)) {
- return 0;
- }
- }
- return 1;
-}
-
+static int
+equal_ignore_case(PyObject *left, PyObject *right)
+{
+ int eq = PyObject_RichCompareBool(left, right, Py_EQ);
+ if (eq) { /* equal or error */
+ return eq;
+ }
+ if (!PyUnicode_Check(left) || !PyUnicode_Check(right)) {
+ return 0;
+ }
+ if (!PyUnicode_IS_ASCII(left) || !PyUnicode_IS_ASCII(right)) {
+ return 0;
+ }
+
+ Py_ssize_t len = PyUnicode_GET_LENGTH(left);
+ if (PyUnicode_GET_LENGTH(right) != len) {
+ return 0;
+ }
+ const Py_UCS1 *p1 = PyUnicode_1BYTE_DATA(left);
+ const Py_UCS1 *p2 = PyUnicode_1BYTE_DATA(right);
+ for (; len; len--, p1++, p2++) {
+ if (Py_TOLOWER(*p1) != Py_TOLOWER(*p2)) {
+ return 0;
+ }
+ }
+ return 1;
+}
+
PyObject* pysqlite_row_subscript(pysqlite_Row* self, PyObject* idx)
{
Py_ssize_t _idx;
@@ -126,11 +126,11 @@ PyObject* pysqlite_row_subscript(pysqlite_Row* self, PyObject* idx)
PyObject *obj;
obj = PyTuple_GET_ITEM(self->description, i);
obj = PyTuple_GET_ITEM(obj, 0);
- int eq = equal_ignore_case(idx, obj);
- if (eq < 0) {
+ int eq = equal_ignore_case(idx, obj);
+ if (eq < 0) {
return NULL;
}
- if (eq) {
+ if (eq) {
/* found item */
item = PyTuple_GetItem(self->data, i);
Py_INCREF(item);
@@ -156,7 +156,7 @@ pysqlite_row_length(pysqlite_Row* self)
return PyTuple_GET_SIZE(self->data);
}
-PyObject* pysqlite_row_keys(pysqlite_Row* self, PyObject *Py_UNUSED(ignored))
+PyObject* pysqlite_row_keys(pysqlite_Row* self, PyObject *Py_UNUSED(ignored))
{
PyObject* list;
Py_ssize_t nitems, i;
@@ -192,16 +192,16 @@ static PyObject* pysqlite_row_richcompare(pysqlite_Row *self, PyObject *_other,
if (opid != Py_EQ && opid != Py_NE)
Py_RETURN_NOTIMPLEMENTED;
- if (PyObject_TypeCheck(_other, &pysqlite_RowType)) {
+ if (PyObject_TypeCheck(_other, &pysqlite_RowType)) {
pysqlite_Row *other = (pysqlite_Row *)_other;
- int eq = PyObject_RichCompareBool(self->description, other->description, Py_EQ);
- if (eq < 0) {
- return NULL;
- }
- if (eq) {
+ int eq = PyObject_RichCompareBool(self->description, other->description, Py_EQ);
+ if (eq < 0) {
+ return NULL;
+ }
+ if (eq) {
return PyObject_RichCompare(self->data, other->data, opid);
}
- return PyBool_FromLong(opid != Py_EQ);
+ return PyBool_FromLong(opid != Py_EQ);
}
Py_RETURN_NOTIMPLEMENTED;
}
@@ -233,10 +233,10 @@ PyTypeObject pysqlite_RowType = {
sizeof(pysqlite_Row), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)pysqlite_row_dealloc, /* tp_dealloc */
- 0, /* tp_vectorcall_offset */
+ 0, /* tp_vectorcall_offset */
0, /* tp_getattr */
0, /* tp_setattr */
- 0, /* tp_as_async */
+ 0, /* tp_as_async */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
diff --git a/contrib/tools/python3/src/Modules/_sqlite/row.h b/contrib/tools/python3/src/Modules/_sqlite/row.h
index 4ad506f8dd..5607e2e467 100644
--- a/contrib/tools/python3/src/Modules/_sqlite/row.h
+++ b/contrib/tools/python3/src/Modules/_sqlite/row.h
@@ -23,7 +23,7 @@
#ifndef PYSQLITE_ROW_H
#define PYSQLITE_ROW_H
-#define PY_SSIZE_T_CLEAN
+#define PY_SSIZE_T_CLEAN
#include "Python.h"
typedef struct _Row
diff --git a/contrib/tools/python3/src/Modules/_sqlite/statement.c b/contrib/tools/python3/src/Modules/_sqlite/statement.c
index 23c204e752..b3fceab7f7 100644
--- a/contrib/tools/python3/src/Modules/_sqlite/statement.c
+++ b/contrib/tools/python3/src/Modules/_sqlite/statement.c
@@ -59,8 +59,8 @@ int pysqlite_statement_create(pysqlite_Statement* self, pysqlite_Connection* con
self->st = NULL;
self->in_use = 0;
- assert(PyUnicode_Check(sql));
-
+ assert(PyUnicode_Check(sql));
+
sql_cstr = PyUnicode_AsUTF8AndSize(sql, &sql_cstr_len);
if (sql_cstr == NULL) {
rc = PYSQLITE_SQL_WRONG_TYPE;
@@ -227,9 +227,9 @@ void pysqlite_statement_bind_parameters(pysqlite_Statement* self, PyObject* para
num_params = PyList_GET_SIZE(parameters);
} else {
num_params = PySequence_Size(parameters);
- if (num_params == -1) {
- return;
- }
+ if (num_params == -1) {
+ return;
+ }
}
if (num_params != num_params_needed) {
PyErr_Format(pysqlite_ProgrammingError,
@@ -241,9 +241,9 @@ void pysqlite_statement_bind_parameters(pysqlite_Statement* self, PyObject* para
for (i = 0; i < num_params; i++) {
if (PyTuple_CheckExact(parameters)) {
current_param = PyTuple_GET_ITEM(parameters, i);
- Py_INCREF(current_param);
+ Py_INCREF(current_param);
} else if (PyList_CheckExact(parameters)) {
- current_param = PyList_GetItem(parameters, i);
+ current_param = PyList_GetItem(parameters, i);
Py_XINCREF(current_param);
} else {
current_param = PySequence_GetItem(parameters, i);
@@ -255,10 +255,10 @@ void pysqlite_statement_bind_parameters(pysqlite_Statement* self, PyObject* para
if (!_need_adapt(current_param)) {
adapted = current_param;
} else {
- adapted = pysqlite_microprotocols_adapt(current_param, (PyObject*)&pysqlite_PrepareProtocolType, current_param);
- Py_DECREF(current_param);
- if (!adapted) {
- return;
+ adapted = pysqlite_microprotocols_adapt(current_param, (PyObject*)&pysqlite_PrepareProtocolType, current_param);
+ Py_DECREF(current_param);
+ if (!adapted) {
+ return;
}
}
@@ -275,7 +275,7 @@ void pysqlite_statement_bind_parameters(pysqlite_Statement* self, PyObject* para
} else if (PyDict_Check(parameters)) {
/* parameters passed as dictionary */
for (i = 1; i <= num_params_needed; i++) {
- PyObject *binding_name_obj;
+ PyObject *binding_name_obj;
Py_BEGIN_ALLOW_THREADS
binding_name = sqlite3_bind_parameter_name(self->st, i);
Py_END_ALLOW_THREADS
@@ -285,31 +285,31 @@ void pysqlite_statement_bind_parameters(pysqlite_Statement* self, PyObject* para
}
binding_name++; /* skip first char (the colon) */
- binding_name_obj = PyUnicode_FromString(binding_name);
- if (!binding_name_obj) {
- return;
- }
+ binding_name_obj = PyUnicode_FromString(binding_name);
+ if (!binding_name_obj) {
+ return;
+ }
if (PyDict_CheckExact(parameters)) {
- current_param = PyDict_GetItemWithError(parameters, binding_name_obj);
+ current_param = PyDict_GetItemWithError(parameters, binding_name_obj);
Py_XINCREF(current_param);
} else {
- current_param = PyObject_GetItem(parameters, binding_name_obj);
+ current_param = PyObject_GetItem(parameters, binding_name_obj);
}
- Py_DECREF(binding_name_obj);
+ Py_DECREF(binding_name_obj);
if (!current_param) {
- if (!PyErr_Occurred() || PyErr_ExceptionMatches(PyExc_LookupError)) {
- PyErr_Format(pysqlite_ProgrammingError, "You did not supply a value for binding %d.", i);
- }
+ if (!PyErr_Occurred() || PyErr_ExceptionMatches(PyExc_LookupError)) {
+ PyErr_Format(pysqlite_ProgrammingError, "You did not supply a value for binding %d.", i);
+ }
return;
}
if (!_need_adapt(current_param)) {
adapted = current_param;
} else {
- adapted = pysqlite_microprotocols_adapt(current_param, (PyObject*)&pysqlite_PrepareProtocolType, current_param);
- Py_DECREF(current_param);
- if (!adapted) {
- return;
+ adapted = pysqlite_microprotocols_adapt(current_param, (PyObject*)&pysqlite_PrepareProtocolType, current_param);
+ Py_DECREF(current_param);
+ if (!adapted) {
+ return;
}
}
@@ -464,10 +464,10 @@ PyTypeObject pysqlite_StatementType = {
sizeof(pysqlite_Statement), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)pysqlite_statement_dealloc, /* tp_dealloc */
- 0, /* tp_vectorcall_offset */
+ 0, /* tp_vectorcall_offset */
0, /* tp_getattr */
0, /* tp_setattr */
- 0, /* tp_as_async */
+ 0, /* tp_as_async */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
diff --git a/contrib/tools/python3/src/Modules/_sqlite/statement.h b/contrib/tools/python3/src/Modules/_sqlite/statement.h
index 5002f02dc5..e202c9fcff 100644
--- a/contrib/tools/python3/src/Modules/_sqlite/statement.h
+++ b/contrib/tools/python3/src/Modules/_sqlite/statement.h
@@ -23,7 +23,7 @@
#ifndef PYSQLITE_STATEMENT_H
#define PYSQLITE_STATEMENT_H
-#define PY_SSIZE_T_CLEAN
+#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "connection.h"
diff --git a/contrib/tools/python3/src/Modules/_sqlite/util.h b/contrib/tools/python3/src/Modules/_sqlite/util.h
index c5a220e9b0..0b245507ba 100644
--- a/contrib/tools/python3/src/Modules/_sqlite/util.h
+++ b/contrib/tools/python3/src/Modules/_sqlite/util.h
@@ -23,7 +23,7 @@
#ifndef PYSQLITE_UTIL_H
#define PYSQLITE_UTIL_H
-#define PY_SSIZE_T_CLEAN
+#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "pythread.h"
#include "sqlite3.h"
diff --git a/contrib/tools/python3/src/Modules/_sqlite/ya.make b/contrib/tools/python3/src/Modules/_sqlite/ya.make
index 44f7188be0..5267d20767 100644
--- a/contrib/tools/python3/src/Modules/_sqlite/ya.make
+++ b/contrib/tools/python3/src/Modules/_sqlite/ya.make
@@ -19,10 +19,10 @@ IF (USE_SYSTEM_PYTHON)
)
ENDIF()
-CFLAGS(
- -DMODULE_NAME=\"sqlite3\"
-)
-
+CFLAGS(
+ -DMODULE_NAME=\"sqlite3\"
+)
+
PYTHON3_ADDINCL()
NO_COMPILER_WARNINGS()