"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.
This commit is contained in:
Guido van Rossum 2007-08-29 03:34:29 +00:00
parent 625cbf28ee
commit fa9a121952
2 changed files with 9 additions and 3 deletions

View file

@ -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);