diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_sqlite/connection.c | 14 | ||||
-rw-r--r-- | Modules/_sqlite/module.c | 4 |
2 files changed, 11 insertions, 7 deletions
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index 3fd95f1..5f899e8 100644 --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -87,7 +87,7 @@ int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject } if (!isolation_level) { - isolation_level = PyString_FromString(""); + isolation_level = PyUnicode_FromString(""); if (!isolation_level) { return -1; } @@ -828,24 +828,28 @@ static int pysqlite_connection_set_isolation_level(pysqlite_Connection* self, Py self->inTransaction = 0; } else { + const char *statement; + Py_ssize_t size; + Py_INCREF(isolation_level); self->isolation_level = isolation_level; - begin_statement = PyString_FromString("BEGIN "); + begin_statement = PyUnicode_FromString("BEGIN "); if (!begin_statement) { return -1; } - PyString_Concat(&begin_statement, isolation_level); + PyUnicode_Concat(begin_statement, isolation_level); if (!begin_statement) { return -1; } - self->begin_statement = PyMem_Malloc(PyString_Size(begin_statement) + 2); + statement = PyUnicode_AsStringAndSize(begin_statement, &size); + self->begin_statement = PyMem_Malloc(size + 2); if (!self->begin_statement) { return -1; } - strcpy(self->begin_statement, PyString_AsString(begin_statement)); + strcpy(self->begin_statement, statement); Py_DECREF(begin_statement); } diff --git a/Modules/_sqlite/module.c b/Modules/_sqlite/module.c index 4525c61..61ac0a1 100644 --- a/Modules/_sqlite/module.c +++ b/Modules/_sqlite/module.c @@ -359,13 +359,13 @@ PyMODINIT_FUNC init_sqlite3(void) Py_DECREF(tmp_obj); } - if (!(tmp_obj = PyString_FromString(PYSQLITE_VERSION))) { + if (!(tmp_obj = PyUnicode_FromString(PYSQLITE_VERSION))) { goto error; } PyDict_SetItemString(dict, "version", tmp_obj); Py_DECREF(tmp_obj); - if (!(tmp_obj = PyString_FromString(sqlite3_libversion()))) { + if (!(tmp_obj = PyUnicode_FromString(sqlite3_libversion()))) { goto error; } PyDict_SetItemString(dict, "sqlite_version", tmp_obj); |