diff Modules/_sqlite/cursor.c @ 42970:cb5ae020a060

"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.
author Guido van Rossum <guido@python.org>
date Wed, 29 Aug 2007 03:34:29 +0000
parents d1855d0e4e03
children 0d28a520c9b1
line wrap: on
line diff
--- a/Modules/_sqlite/cursor.c	Wed Aug 29 03:22:59 2007 +0000
+++ b/Modules/_sqlite/cursor.c	Wed Aug 29 03:34:29 2007 +0000
@@ -497,8 +497,10 @@
         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);