mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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).
This commit is contained in:
parent
85c1ba5d74
commit
bae07c9baf
24 changed files with 72 additions and 199 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue