diff options
Diffstat (limited to 'Modules/_sqlite')
-rw-r--r-- | Modules/_sqlite/connection.c | 2 | ||||
-rw-r--r-- | Modules/_sqlite/connection.h | 2 | ||||
-rw-r--r-- | Modules/_sqlite/cursor.c | 8 | ||||
-rw-r--r-- | Modules/_sqlite/statement.c | 2 |
4 files changed, 7 insertions, 7 deletions
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index 667c3f0..2d1b822 100644 --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -483,7 +483,7 @@ PyObject* _pysqlite_build_py_params(sqlite3_context *context, int argc, sqlite3_ break; case SQLITE_BLOB: buflen = sqlite3_value_bytes(cur_value); - cur_py_value = PyString_FromStringAndSize( + cur_py_value = PyBytes_FromStringAndSize( sqlite3_value_blob(cur_value), buflen); break; case SQLITE_NULL: diff --git a/Modules/_sqlite/connection.h b/Modules/_sqlite/connection.h index dd177ae..af414a0 100644 --- a/Modules/_sqlite/connection.h +++ b/Modules/_sqlite/connection.h @@ -80,7 +80,7 @@ typedef struct /* Determines how bytestrings from SQLite are converted to Python objects: * - PyUnicode_Type: Python Unicode objects are constructed from UTF-8 bytestrings * - OptimizedUnicode: Like before, but for ASCII data, only PyStrings are created. - * - PyString_Type: PyStrings are created as-is. + * - PyBytes_Type: PyStrings are created as-is. * - Any custom callable: Any object returned from the callable called with the bytestring * as single parameter. */ diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c index 4ab8461..243b0b6 100644 --- a/Modules/_sqlite/cursor.c +++ b/Modules/_sqlite/cursor.c @@ -311,7 +311,7 @@ PyObject* _pysqlite_fetch_one_row(pysqlite_Cursor* self) Py_INCREF(Py_None); converted = Py_None; } else { - item = PyString_FromStringAndSize(val_str, nbytes); + item = PyBytes_FromStringAndSize(val_str, nbytes); if (!item) { return NULL; } @@ -366,8 +366,8 @@ PyObject* _pysqlite_fetch_one_row(pysqlite_Cursor* self) Py_DECREF(buf_bytes); } } - } else if (self->connection->text_factory == (PyObject*)&PyString_Type) { - converted = PyString_FromString(val_str); + } else if (self->connection->text_factory == (PyObject*)&PyBytes_Type) { + converted = PyBytes_FromString(val_str); } else if (self->connection->text_factory == (PyObject*)&PyByteArray_Type) { converted = PyByteArray_FromStringAndSize(val_str, strlen(val_str)); } else { @@ -376,7 +376,7 @@ PyObject* _pysqlite_fetch_one_row(pysqlite_Cursor* self) } else { /* coltype == SQLITE_BLOB */ nbytes = sqlite3_column_bytes(self->statement->st, i); - buffer = PyString_FromStringAndSize( + buffer = PyBytes_FromStringAndSize( sqlite3_column_blob(self->statement->st, i), nbytes); if (!buffer) { break; diff --git a/Modules/_sqlite/statement.c b/Modules/_sqlite/statement.c index ddbb85e..fb1eec7 100644 --- a/Modules/_sqlite/statement.c +++ b/Modules/_sqlite/statement.c @@ -120,7 +120,7 @@ int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObjec } if (paramtype == TYPE_STRING && !allow_8bit_chars) { - string = PyString_AS_STRING(parameter); + string = PyBytes_AS_STRING(parameter); for (c = string; *c != 0; c++) { if (*c & 0x80) { PyErr_SetString(pysqlite_ProgrammingError, "You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings."); |