summaryrefslogtreecommitdiff
path: root/Modules/_sqlite/cursor.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-10-08 02:46:15 +0000
committerGuido van Rossum <guido@python.org>2007-10-08 02:46:15 +0000
commit59254e3678b101261172811326cdb8cd05c1c251 (patch)
tree1b7f996836171067650f2cee4a159be75b122065 /Modules/_sqlite/cursor.c
parent07c7c425857133061a209f7b590089652b6bdc13 (diff)
downloadcpython-59254e3678b101261172811326cdb8cd05c1c251.tar.gz
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 c468754e75..638cbe2870 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;
}
}