summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite/cursor.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-08-29 03:34:29 (GMT)
committerGuido van Rossum <guido@python.org>2007-08-29 03:34:29 (GMT)
commitfa9a121952db01168e8d131549680d8bb8e9ddb7 (patch)
treed5b34d56a98e011f5ad8593ba404882c3d2c62e1 /Modules/_sqlite/cursor.c
parent625cbf28eeeed3f2d8afffa6c442f10d58ae6607 (diff)
downloadcpython-fa9a121952db01168e8d131549680d8bb8e9ddb7.zip
cpython-fa9a121952db01168e8d131549680d8bb8e9ddb7.tar.gz
cpython-fa9a121952db01168e8d131549680d8bb8e9ddb7.tar.bz2
"Fix" a few places that were using PyObject_AsCharBuffer() to convert a string
(PyUnicode these days) to a char* + length. The fix consists of calling PyUnicode_AsString() and strlen(). This is not ideal, but AsCharBuffer() is definitely not the API to use.
Diffstat (limited to 'Modules/_sqlite/cursor.c')
-rw-r--r--Modules/_sqlite/cursor.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c
index 9c295a6..55a1ffc 100644
--- a/Modules/_sqlite/cursor.c
+++ b/Modules/_sqlite/cursor.c
@@ -497,8 +497,10 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject*
rc = pysqlite_statement_reset(self->statement);
}
- if (PyObject_AsCharBuffer(operation, &operation_cstr, &operation_len) < 0)
+ operation_cstr = PyUnicode_AsString(operation);
+ if (operation == NULL)
goto error;
+ operation_len = strlen(operation_cstr); /* XXX */
/* reset description and rowcount */
Py_DECREF(self->description);