summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2007-10-27 02:50:52 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2007-10-27 02:50:52 (GMT)
commitefee9f5f1d4b404785b91242b62aa7af22de9b47 (patch)
tree09a549e51e1728ad4f94ee42d8a4e095d84662f3
parentae404e2e0a957e1e584b476e21c51201e611ab44 (diff)
downloadcpython-efee9f5f1d4b404785b91242b62aa7af22de9b47.zip
cpython-efee9f5f1d4b404785b91242b62aa7af22de9b47.tar.gz
cpython-efee9f5f1d4b404785b91242b62aa7af22de9b47.tar.bz2
Use unicode in more places. Fixes a problem with str8 + str in test.
-rw-r--r--Modules/_sqlite/connection.c14
-rw-r--r--Modules/_sqlite/module.c4
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);