Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 24ed220

Browse filesBrowse files
committed
Don't support blob operation
1 parent 7ea9719 commit 24ed220
Copy full SHA for 24ed220

File tree

Expand file treeCollapse file tree

2 files changed

+14
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+14
-0
lines changed

‎Lib/sqlite3/test/dbapi.py

Copy file name to clipboardExpand all lines: Lib/sqlite3/test/dbapi.py
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,10 @@ def CheckBlobRepeateNotSupported(self):
677677
with self.assertRaises(SystemError):
678678
self.blob * 5
679679

680+
def CheckBlobContainsNotSupported(self):
681+
with self.assertRaises(SystemError):
682+
b"aaaaa" in self.blob
683+
680684
@unittest.skipUnless(threading, 'This test requires threading.')
681685
class ThreadTests(unittest.TestCase):
682686
def setUp(self):

‎Modules/_sqlite/blob.c

Copy file name to clipboardExpand all lines: Modules/_sqlite/blob.c
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,15 @@ static PyObject* pysqlite_blob_repeat(pysqlite_Blob *self, PyObject *args)
327327
return NULL;
328328
}
329329

330+
static int pysqlite_blob_contains(pysqlite_Blob *self, PyObject *args)
331+
{
332+
if (pysqlite_check_blob(self)) {
333+
PyErr_SetString(PyExc_SystemError,
334+
"Blob don't support cotains operation");
335+
}
336+
return -1;
337+
}
338+
330339
static PyObject* pysqlite_blob_item(pysqlite_Blob *self, Py_ssize_t i)
331340
{
332341
if (!pysqlite_check_blob(self)) {
@@ -606,6 +615,7 @@ static PySequenceMethods blob_sequence_methods = {
606615
.sq_repeat = (ssizeargfunc)pysqlite_blob_repeat,
607616
.sq_item = (ssizeargfunc)pysqlite_blob_item,
608617
.sq_ass_item = (ssizeobjargproc)pysqlite_blob_ass_item,
618+
.sq_contains = (objobjproc)pysqlite_blob_contains,
609619
};
610620

611621
static PyMappingMethods blob_mapping_methods = {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.