diff options
Diffstat (limited to 'Modules')
| -rw-r--r-- | Modules/_collectionsmodule.c | 1 | ||||
| -rw-r--r-- | Modules/_sqlite/statement.c | 6 | ||||
| -rw-r--r-- | Modules/_sqlite/util.c | 12 | ||||
| -rw-r--r-- | Modules/xxmodule.c | 2 |
4 files changed, 16 insertions, 5 deletions
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index 20c0774065..0d1df5faa5 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -784,6 +784,7 @@ deque_init(dequeobject *deque, PyObject *args, PyObject *kwdargs) } } deque->maxlen = maxlen; + deque_clear(deque); if (iterable != NULL) { PyObject *rv = deque_extend(deque, iterable); if (rv == NULL) diff --git a/Modules/_sqlite/statement.c b/Modules/_sqlite/statement.c index f81e64299f..126ba6f726 100644 --- a/Modules/_sqlite/statement.c +++ b/Modules/_sqlite/statement.c @@ -231,7 +231,11 @@ int pysqlite_statement_recompile(pysqlite_Statement* self, PyObject* params) */ #ifdef SQLITE_VERSION_NUMBER #if SQLITE_VERSION_NUMBER >= 3002002 - (void)sqlite3_transfer_bindings(self->st, new_st); + /* The check for the number of parameters is necessary to not trigger a + * bug in certain SQLite versions (experienced in 3.2.8 and 3.3.4). */ + if (sqlite3_bind_parameter_count(self->st) > 0) { + (void)sqlite3_transfer_bindings(self->st, new_st); + } #endif #else statement_bind_parameters(self, params); diff --git a/Modules/_sqlite/util.c b/Modules/_sqlite/util.c index b70297b927..5e78d58846 100644 --- a/Modules/_sqlite/util.c +++ b/Modules/_sqlite/util.c @@ -28,9 +28,15 @@ int _sqlite_step_with_busyhandler(sqlite3_stmt* statement, pysqlite_Connection* { int rc; - Py_BEGIN_ALLOW_THREADS - rc = sqlite3_step(statement); - Py_END_ALLOW_THREADS + if (statement == NULL) { + /* this is a workaround for SQLite 3.5 and later. it now apparently + * returns NULL for "no-operation" statements */ + rc = SQLITE_OK; + } else { + Py_BEGIN_ALLOW_THREADS + rc = sqlite3_step(statement); + Py_END_ALLOW_THREADS + } return rc; } diff --git a/Modules/xxmodule.c b/Modules/xxmodule.c index 6b998b13fe..5c371fb60e 100644 --- a/Modules/xxmodule.c +++ b/Modules/xxmodule.c @@ -349,7 +349,7 @@ initxx(void) Str_Type.tp_base = &PyUnicode_Type; /* Finalize the type object including setting type of the new type - * object; doing it here is required for portability, too. /* + * object; doing it here is required for portability, too. */ if (PyType_Ready(&Xxo_Type) < 0) return; |
