summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_sqlite')
-rw-r--r--Modules/_sqlite/connection.c3
-rw-r--r--Modules/_sqlite/connection.h2
-rw-r--r--Modules/_sqlite/cursor.c6
-rw-r--r--Modules/_sqlite/microprotocols.h2
-rw-r--r--Modules/_sqlite/row.c5
5 files changed, 8 insertions, 10 deletions
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
index d390328..a08ebfe 100644
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -1241,6 +1241,9 @@ PyObject* pysqlite_connection_call(pysqlite_Connection* self, PyObject* args, Py
return NULL;
}
+ if (!_PyArg_NoKeywords(MODULE_NAME ".Connection()", kwargs))
+ return NULL;
+
if (!PyArg_ParseTuple(args, "O", &sql))
return NULL;
diff --git a/Modules/_sqlite/connection.h b/Modules/_sqlite/connection.h
index 0c9734c..fbd9063 100644
--- a/Modules/_sqlite/connection.h
+++ b/Modules/_sqlite/connection.h
@@ -52,7 +52,7 @@ typedef struct
* first get called with count=0? */
double timeout_started;
- /* None for autocommit, otherwise a PyString with the isolation level */
+ /* None for autocommit, otherwise a PyUnicode with the isolation level */
PyObject* isolation_level;
/* NULL for autocommit, otherwise a string with the BEGIN statement; will be
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c
index db96b02..c1599c0 100644
--- a/Modules/_sqlite/cursor.c
+++ b/Modules/_sqlite/cursor.c
@@ -46,7 +46,7 @@ static pysqlite_StatementKind detect_statement_type(const char* statement)
dst = buf;
*dst = 0;
- while (Py_ISALPHA(*src) && dst - buf < sizeof(buf) - 2) {
+ while (Py_ISALPHA(*src) && (dst - buf) < ((Py_ssize_t)sizeof(buf) - 2)) {
*dst++ = Py_TOLOWER(*src++);
}
@@ -334,11 +334,7 @@ PyObject* _pysqlite_fetch_one_row(pysqlite_Cursor* self)
if (self->connection->text_factory == (PyObject*)&PyUnicode_Type) {
converted = PyUnicode_FromStringAndSize(val_str, nbytes);
if (!converted) {
-#ifdef Py_DEBUG
- /* in debug mode, type_call() fails with an assertion
- error if an exception is set when it is called */
PyErr_Clear();
-#endif
colname = sqlite3_column_name(self->statement->st, i);
if (!colname) {
colname = "<unknown column name>";
diff --git a/Modules/_sqlite/microprotocols.h b/Modules/_sqlite/microprotocols.h
index 3a9944f..6941716 100644
--- a/Modules/_sqlite/microprotocols.h
+++ b/Modules/_sqlite/microprotocols.h
@@ -48,7 +48,7 @@ extern PyObject *pysqlite_microprotocols_adapt(
PyObject *obj, PyObject *proto, PyObject *alt);
extern PyObject *
- pysqlite_adapt(pysqlite_Cursor* self, PyObject *args);
+ pysqlite_adapt(pysqlite_Cursor* self, PyObject *args);
#define pysqlite_adapt_doc \
"adapt(obj, protocol, alternate) -> adapt obj to given protocol. Non-standard."
diff --git a/Modules/_sqlite/row.c b/Modules/_sqlite/row.c
index ee73446..07584e3 100644
--- a/Modules/_sqlite/row.c
+++ b/Modules/_sqlite/row.c
@@ -142,8 +142,7 @@ PyObject* pysqlite_row_subscript(pysqlite_Row* self, PyObject* idx)
return NULL;
}
else if (PySlice_Check(idx)) {
- PyErr_SetString(PyExc_ValueError, "slices not implemented, yet");
- return NULL;
+ return PyObject_GetItem(self->data, idx);
}
else {
PyErr_SetString(PyExc_IndexError, "Index must be int or string");
@@ -159,7 +158,7 @@ Py_ssize_t pysqlite_row_length(pysqlite_Row* self, PyObject* args, PyObject* kwa
PyObject* pysqlite_row_keys(pysqlite_Row* self, PyObject* args, PyObject* kwargs)
{
PyObject* list;
- int nitems, i;
+ Py_ssize_t nitems, i;
list = PyList_New(0);
if (!list) {