8000 bpo-24905: Support BLOB incremental I/O in sqlite module by palaviv · Pull Request #271 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-24905: Support BLOB incremental I/O in sqlite module #271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Don't support blob operation
  • Loading branch information
palaviv committed Jul 29, 2020
commit 219f4cb4a1b3db1783f4e9c272cd3e6de4028908
4 changes: 4 additions & 0 deletions Lib/sqlite3/test/dbapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,10 @@ def CheckBlobRepeateNotSupported(self):
with self.assertRaises(SystemError):
self.blob * 5

def CheckBlobContainsNotSupported(self):
with self.assertRaises(SystemError):
b"aaaaa" in self.blob

@unittest.skipUnless(threading, 'This test requires threading.')
class ThreadTests(unittest.TestCase):
def setUp(self):
Expand Down
10 changes: 10 additions & 0 deletions Modules/_sqlite/blob.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,15 @@ static PyObject* pysqlite_blob_repeat(pysqlite_Blob *self, PyObject *args)
return NULL;
}

static int pysqlite_blob_contains(pysqlite_Blob *self, PyObject *args)
{
if (pysqlite_check_blob(self)) {
PyErr_SetString(PyExc_SystemError,
"Blob don't support cotains operation");
}
return -1;
}

static PyObject* pysqlite_blob_item(pysqlite_Blob *self, Py_ssize_t i)
{
if (!pysqlite_check_blob(self)) {
Expand Down Expand Up @@ -606,6 +615,7 @@ static PySequenceMethods blob_sequence_methods = {
.sq_repeat = (ssizeargfunc)pysqlite_blob_repeat,
.sq_item = (ssizeargfunc)pysqlite_blob_item,
.sq_ass_item = (ssizeobjargproc)pysqlite_blob_ass_item,
.sq_contains = (objobjproc)pysqlite_blob_contains,
};

static PyMappingMethods blob_mapping_methods = {
Expand Down
0