summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite/cursor.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-10-08 02:46:15 (GMT)
committerGuido van Rossum <guido@python.org>2007-10-08 02:46:15 (GMT)
commitbae07c9baf3e53164de6f85a18ce747a76b9ffde (patch)
treee0bf84063848730026bea64461fe3920dbe8ecb8 /Modules/_sqlite/cursor.c
parent85c1ba5d742779eec3148377ce6d8d359d318263 (diff)
downloadcpython-bae07c9baf3e53164de6f85a18ce747a76b9ffde.zip
cpython-bae07c9baf3e53164de6f85a18ce747a76b9ffde.tar.gz
cpython-bae07c9baf3e53164de6f85a18ce747a76b9ffde.tar.bz2
Breaking ground for PEP 3137 implementation:
Get rid of buffer(). Use memoryview() in its place where possible. In a few places, do things a bit different, because memoryview() can't slice (yet).
Diffstat (limited to 'Modules/_sqlite/cursor.c')
-rw-r--r--Modules/_sqlite/cursor.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c
index c468754..638cbe2 100644
--- a/Modules/_sqlite/cursor.c
+++ b/Modules/_sqlite/cursor.c
@@ -380,14 +380,11 @@ PyObject* _pysqlite_fetch_one_row(pysqlite_Cursor* self)
} else {
/* coltype == SQLITE_BLOB */
nbytes = sqlite3_column_bytes(self->statement->st, i);
- buffer = PyBuffer_New(nbytes);
+ buffer = PyBytes_FromStringAndSize(
+ sqlite3_column_blob(self->statement->st, i), nbytes);
if (!buffer) {
break;
}
- if (PyObject_AsWriteBuffer(buffer, &raw_buffer, &nbytes)) {
- break;
- }
- memcpy(raw_buffer, sqlite3_column_blob(self->statement->st, i), nbytes);
converted = buffer;
}
}